Giter Site home page Giter Site logo

noriste / gatsby-plugin-iubenda-cookie-footer Goto Github PK

View Code? Open in Web Editor NEW
11.0 1.0 5.0 2.62 MB

Gatsby plugin to add the Iubenda's cookie policy banner

Home Page: https://www.npmjs.com/package/gatsby-plugin-iubenda-cookie-footer

JavaScript 100.00%
gatsby iubenda gatsby-plugin

gatsby-plugin-iubenda-cookie-footer's Introduction

gatsby-plugin-iubenda-cookie-footer

Quickly add the Iubenda's cookie policy banner to your Gatsby site. Optionally, it integrates the Iubenda acceptance with Google Tag Manager.

Build Status Build Cron Renovate enabled
Commitizen friendly FOSSA Status Open Source Love

Install

npm install --save gatsby-plugin-iubenda-cookie-footer

What this plugin does

  • it adds the Iubenda cookie footer
  • (optional) it integrates the Iubenda's acceptance with Google Tag Manager, that means:
    • it pushes the iubenda_consent_given event to the Google Tag Manager (GTM) data layer
    • it pushes the iubenda_consent_given event to the GTM data layer when the user navigates to the different routes
    • it allows you to customize both the GTM event pushed and the GTM data layer name

What this plugin does not

How to use

Basic usage

// In your gatsby-config.js
plugins: [
  {
    resolve: 'gatsby-plugin-iubenda-cookie-footer',
    options: {
      iubendaOptions: {"lang":"en","siteId":XXXXX,"cookiePolicyId":YYYYY, /* ... */ },
    }
  }
]

You can copy/paste the iubendaOptions from the Iubenda embed script:

Where to find the iubendaOptions

Usage with Google Tag Manager

// In your gatsby-config.js
plugins: [
  {
    resolve: 'gatsby-plugin-iubenda-cookie-footer',
    options: {
    iubendaOptions: {"lang":"en","siteId":XXXXX,"cookiePolicyId":YYYYY, /* ... */ },
    // optional, if present, a Google Tag Manager event ("iubenda_consent_given") is triggered
    googleTagManagerOptions: true
  }
]

The user acceptance is pushed to the GTM data layers as explained by the official Iubenda guide.

Usage with Google Tag Manager and custom event/dataLayer name

// In your gatsby-config.js
plugins: [
  {
    resolve: 'gatsby-plugin-iubenda-cookie-footer',
    options: {
    iubendaOptions: {"lang":"en","siteId":XXXXX,"cookiePolicyId":YYYYY, /* ... */ },
    // optional, if present, the Google Tag Manager callback is added
    googleTagManagerOptions: {
        // optional, default to "iubenda_consent_given"
        eventName: "custom_iubenda_event_name",
        // optional, default to "dataLayer"
        dataLayerName: "customDataLayerName"
    }
  }
]

Contributing

PR or issues are welcome ๐Ÿ‘‹

Notes

  • if you want to work on the plugin sources, remember that you need to npm run build on the root then, in every test project, you need to run npm run plugin:link to locally use it
  • a nicer testing solution could be to leverage the Travis jobs/envs instead of running them synchronously

Contributors โœจ

Thanks goes to these wonderful people (emoji key):


Stefano Magni

๐Ÿค” ๐Ÿ’ป โš ๏ธ ๐Ÿ“–

Patrick Menlove

๐Ÿ› ๐Ÿ’ป ๐Ÿ‘€ โš ๏ธ

This project follows the all-contributors specification. Contributions of any kind welcome!

gatsby-plugin-iubenda-cookie-footer's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

gatsby-plugin-iubenda-cookie-footer's Issues

Custom preferences button instead of automatically added floating button

The iubenda widget offers to optionally hide the floating button and instead add a custom link that opens it (see docs). If I understand correctly, for this the floatingPreferencesButtonDisplay config setting needs to be set to false and a link with the class iubenda-cs-preferences-link needs to be added to the site. I did both in my Gatsby app using this plugin, but it is not working. The floating button is not displayed, but clicking my link does also not open the widget.

Is this a limitation of this plugin or am I missing something?

Race condition in isIubendaConsentGiven()

We've noticed in Sentry that we're seeing the following error coming from the plugin:
Cannot read property 'api' of undefined.

This is down to the check being made in isIubendaConsentGiven(). It currently checks that ._iub exists on the window but it does not check if window._iub.cs has a value.

After looking into this, it looks like .cs is not added to the ._iub object until iubenda_cs.js has loaded (which in turn loads another core file from Iubenda). If the user lands on the website and navigates to a different page before Iubenda has finished loading it satisfies the current condition in isIubendaConsentGiven() yet the .cs property has not been added, causing the error.

I put together a quick PR but I'm unable to push a new branch due to permissions.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

npm
package.json
  • @babel/runtime ^7.4.3
  • @babel/cli 7.14.5
  • @babel/core 7.14.6
  • babel-preset-gatsby-package 1.10.0
  • cross-env 7.0.3
  • cz-conventional-changelog 3.3.0
  • gatsby ^2.0.0 || ^3.0.0 || ^4.0.0
test-projects/base-configuration-test/package.json
  • gatsby ^4.0.2
  • gatsby-plugin-gatsby-cloud ^4.0.0
  • gatsby-plugin-image ^2.0.0
  • gatsby-plugin-manifest ^4.0.0
  • gatsby-plugin-offline ^5.0.0
  • gatsby-plugin-react-helmet ^5.0.0
  • gatsby-plugin-sharp ^4.0.1
  • gatsby-source-filesystem ^4.0.0
  • gatsby-transformer-sharp ^4.0.0
  • prop-types ^15.7.2
  • react ^17.0.1
  • react-dom ^17.0.1
  • react-helmet ^6.1.0
  • prettier ^2.4.1
test-projects/custom-gtm-test/package.json
  • gatsby ^4.0.2
  • gatsby-plugin-gatsby-cloud ^4.0.0
  • gatsby-plugin-image ^2.0.0
  • gatsby-plugin-manifest ^4.0.0
  • gatsby-plugin-offline ^5.0.0
  • gatsby-plugin-react-helmet ^5.0.0
  • gatsby-plugin-sharp ^4.0.1
  • gatsby-source-filesystem ^4.0.0
  • gatsby-transformer-sharp ^4.0.0
  • prop-types ^15.7.2
  • react ^17.0.1
  • react-dom ^17.0.1
  • react-helmet ^6.1.0
  • prettier ^2.4.1
test-projects/gtm-test/package.json
  • gatsby ^4.0.2
  • gatsby-plugin-gatsby-cloud ^4.0.0
  • gatsby-plugin-image ^2.0.0
  • gatsby-plugin-manifest ^4.0.0
  • gatsby-plugin-offline ^5.0.0
  • gatsby-plugin-react-helmet ^5.0.0
  • gatsby-plugin-sharp ^4.0.1
  • gatsby-source-filesystem ^4.0.0
  • gatsby-transformer-sharp ^4.0.0
  • prop-types ^15.7.2
  • react ^17.0.1
  • react-dom ^17.0.1
  • react-helmet ^6.1.0
  • prettier ^2.4.1
travis
.travis.yml
  • node 12

  • Check this box to trigger a request for Renovate to run again on this repository

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: undefined. Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.

"Page Not Found" on Netlify

My site is running on Netlify, the consent banner works as expected but when I click the "Learn more and customize" button or the small tracking preferences widget, the overlay says "Page Not Found". Is there another step in setting this up for the whole cookie solution to work with Netlify?

Gatsby 5 support

According to the package.json this package supports Gatsby v2 - v4. Are the maintainers planning to add v5 support?

Thanks for sharing this btw!

Support for multiple languages

Hi,
first of all thanks a lot for your useful plugin.

As a company we purchased yesterday the services provided by IUBENDA for our website, which shall support 4 languages. Is there currently 'any chance'/'any open development activity' to support multiple languages? In the readme and in the code I could not find anything about yet, but I might we wrong.

Thanks a lot
Fabrizio

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.