npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gatsby-plugin-cookiehub-banner

v0.1.0

Published

Gatsby plugin to use cookie banner generated with cookiehub: https://www.cookiehub.com/

Downloads

239

Readme

gatsby-plugin-cookiehub-banner

Gatsby plugin to use cookie banner generated with cookiehub.

This plugin works in an easy way together with a plugin to add google analytics GDPR compliant: gatsby-plugin-google-analytics-gdpr

Setup Cookiehub

Setup Cookiehub v2

Setup Cookiehub v1

CookieHub v1 which is being phased out. Version 1 is currently sunsetting and will be shut down in May 2021 (EOL plan).

  • Create CookieHub account.
  • Add widget.
  • Configure widget at least with appropriate categories in the category tab.

Install

npm install --save gatsby-plugin-cookiehub-banner

How to use

// In your gatsby-config.js
module.exports = {
  plugins: [
    {
        resolve: `gatsby-plugin-cookiehub-banner`,
        options: {
            // The ID is part of the CookieHub URL: https://cookiehub.net/cc/YOUR_COOKIEHUB_ID.js
            cookieHubId: "YOUR_COOKIEHUB_BANNER_ID",
            // Optional parameter (default false) - Use new v2 API.
            cookieHubV2Api: false
            // Categories configured with CookieHub
            categories: [
            { 
                categoryName: 'analytics', // Unique id of the category which is set by Cookiehub.
                cookieName: 'gatsby-plugin-google-analytics-gdpr_cookies-enabled' // Your custom cookie name
            },
            { 
                categoryName: 'marketing',
                cookieName: 'marketing-enabled'
            }
            ]
        }
    },
  ],
}

How it works

The plugin embeds the script generated by CookieHub to show the cookie banner. On CookieHub initialization and on user input the plugin sets one cookie per category. Depending on the user input the value should be true or false. You can configure your categories in the gatsby-config.js with the according cookie names.

Cookie Handling Example: If you want to integrate Google Analytics, you can start tracking as soon as the analytics cookie is set to true and disable tracking if the user withdraws the choice.

There is a GDPR plugin to use Google Analytics in an easy way with this plugin: gatsby-plugin-google-analytics-gdpr. Install and configure the gatsby-plugin-google-analytics-gdpr plugin and set the analytics category cookie name to gatsby-plugin-google-analytics-gdpr_cookies-enabled.

Options

cookieHubId

The ID is part of the CookieHub URL: https://cookiehub.net/cc/YOUR_COOKIEHUB_ID.js

  • CookieHub v1: Your cookiehub widget ID. You can find the widget ID in the CookieHub tab "Your script" of the appropriate widget.
  • CookieHub v2: Your cookiehub domain code. You can find the code in the overview tab of your configured domain.

cookieHubV2Api

Optional parameter (default false). If true the plugin uses the new Cookiehub API v2.

categories

Define your categories configured with CookieHub. A category consists of categoryName and cookieName.

categoryName

Unique id of the category which you can set in CookieHub categories.

cookieName

Define a custom cookie name. If none cookieName is given, the plugin will generate one.