Security News
The Push to Ban Ransom Payments Is Gaining Momentum
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
@mobile-reality/gatsby-plugin-gdpr-cookies
Advanced tools
Readme
gatsby-plugin-gdpr-cookies
Gatsby pluginyarn add @mobile-reality/gatsby-plugin-gdpr-cookies
or
npm install @mobile-reality/gatsby-plugin-gdpr-cookies
// in your gatsby-config.js
module.exports = {
plugins: [
{
resolve: `gatsby-plugin-gdpr-cookies`,
options: {
googleAnalytics: {
trackingId: 'YOUR_GOOGLE_ANALYTICS_TRACKING_ID', // leave empty if you want to disable the tracker
cookieName: 'gatsby-gdpr-google-analytics', // default
anonymize: true, // default
allowAdFeatures: false // default
},
googleTagManager: {
trackingId: 'YOUR_GOOGLE_TAG_MANAGER_TRACKING_ID', // leave empty if you want to disable the tracker
cookieName: 'gatsby-gdpr-google-tagmanager', // default
dataLayerName: 'dataLayer', // default
},
facebookPixel: {
pixelId: 'YOUR_FACEBOOK_PIXEL_ID', // leave empty if you want to disable the tracker
cookieName: 'gatsby-gdpr-facebook-pixel', // default
},
tikTokPixel: {
pixelId: 'YOUR_TIKTOK_PIXEL_ID', // leave empty if you want to disable the tracker
cookieName: 'gatsby-gdpr-tiktok-pixel', // default
},
hotjar: {
hjid: 'YOUR_HOTJAR_ID',
hjsv: 'YOUR_HOTJAR_SNIPPET_VERSION',
cookieName: 'gatsby-gdpr-hotjar', // default
},
linkedin: {
trackingId: 'YOUR_LINKEDIN_TRACKING_ID', // leave empty if you want to disable the tracker
cookieName: 'gatsby-gdpr-linkedin', // default
},
hubspot: {
trackingId: 'YOUR_HUBSPOT_TRACKING_ID', // leave empty if you want to disable the tracker
cookieName: 'gatsby-gdpr-hubspot', // default
},
googleTag: {
trackingIds: ['YOUR_GOOGLE_TAG_IDS'],
cookieName: 'gatsby-gpdr-google-tag'
},
// defines the environments where the tracking should be available - default is ["production"]
environments: ['production', 'development']
},
},
],
}
First of all the plugin checks in which environment your site is running. If it's currently running in one of your defined environments it will add the tracking code by default to the <head>/<body>
of your site. It will not be activated or initialized by this.
By default this plugin will not send any data to Google or Facebook to make it GDPR compliant. The user first needs to accept your cookie policy. By accepting that you need to set cookies for the tracker you want to use - gatsby-gdpr-google-analytics
, gatsby-gdpr-google-tagmanager
, gatsby-gdpr-facebook-pixel
. Depending on the user input the value of each of the cookies should be true
or false
.
If the gatsby-gdpr-google-analytics
cookie is set to true, Google Analytics will be initialized onClientEntry
. Same is for the Google Tag Manager and Facebook Pixel. The plugin will check if cookies for Google Analytics or Facebook Pixel have been set between route changes on onRouteUpdate
. Reloading the page after setting the cookies is not required anymore.
The page view will be tracked on onRouteUpdate
.
This gatsby plugin now supports initializing and tracking right after a user accepts the cookie consent.
// in your cookie banner
import { useLocation } from "@reach/router" // this helps tracking the location
import { initializeAndTrack } from 'gatsby-plugin-gdpr-cookies'
Then you can execute initializeAndTrack(location)
in your cookie banner callback. This will initialize the plugin with your options from the gatsby-config.js
and then starts tracking the user based on the cookies/services are accepted.
// in your cookie banner
const location = useLocation()
initializeAndTrack(location)
https://github.com/andrezimpel/gatsby-plugin-gdpr-cookies/blob/master/README.md
Andre Zimpel - creator of the original lib https://github.com/andrezimpel/gatsby-plugin-gdpr-cookies
Thanks goes to these wonderful people who helped shaping this project.
FAQs
Gatsby plugin to add google analytics, google tag manager facebook pixel, tik tok pixel, hotjar, hubspot in a gdpr form to your site. Consent coming soon.
We found that @mobile-reality/gatsby-plugin-gdpr-cookies demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 open source maintainers collaborating on the project.
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.
Security News
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
Application Security
New SEC disclosure rules aim to enforce timely cyber incident reporting, but fear of job loss and inadequate resources lead to significant underreporting.
Security News
The Python Software Foundation has secured a 5-year sponsorship from Fastly that supports PSF's activities and events, most notably the security and reliability of the Python Package Index (PyPI).