Socket
Socket
Sign inDemoInstall

gatsby-plugin-cookiehub-banner

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    gatsby-plugin-cookiehub-banner

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


Version published
Weekly downloads
37
increased by37.04%
Maintainers
1
Install size
12.8 kB
Created
Weekly downloads
 

Readme

Source

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.

Keywords

FAQs

Last updated on 06 Apr 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc