Socket
Socket
Sign inDemoInstall

gdpr-constent

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gdpr-constent

GDPR banner to comply with the European cookie law. Inspired by tarteaucitronjs.


Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Build Status

gdpr-consent.js

Comply to the european cookie law. Inspired by AmauriC/tarteaucitron.js

What is this script?

The european cookie law regulates the management of cookies and you should ask your visitors their consent before exposing them to third party services.

Clearly this script will:

  • Disable all services by default,
  • Display a banner on the first page view and a small one on other pages,
  • Display a panel to allow or deny each services one by one,
  • Activate services on the second page view if not denied,
  • Store the consent in a cookie for 365 days.

How to use

<link rel="stylesheet" href="gdpr-consent.css" />
<script type="text/javascript" src="gdpr-consent.js"></script>
<script type="text/javascript">
GDPRConsent.init({
    "hashtag": "#tarteaucitron", /* Open the panel with this hashtag */
	"cookieName": "tarteaucitron", /* Cookie name */
	"timeExpire": 31536000000, /* Cookie expiration time */

	"websiteName": "Les Jours", /* The name of the Website */

    "highPrivacy": true, /* Disable auto consent */
    "AcceptAllCta" : true, /* Show the accept all button when highPrivacy on */

    "moreInfoLink": true, /* Show more info link */

    "mandatory": false /* Show a message about mandatory cookies */
});
</script>

Add services

<script type="text/javascript">
	/* Initialize gdprconsent.js job array */
	GDPRConsent.job = GDPRConsent.job || [];

	/* Add Google Tag Manager */
	GDPRConsent.user.googletagmanagerId = 'GTMID';
	GDPRConsent.job.push('googletagmanager');

	/* Add Google Analytics (gtag.js) */
	GDPRConsent.user.gtagUa = 'GAID';
	GDPRConsent.user.gtagInitOptions = {};
	GDPRConsent.job.push('gtag');

	/* Add Socials Sharing Services : Twitter & Facebook */
	GDPRConsent.job.push('twitter');
	window.fbAsyncInit = function() { FB.init({}); };
	GDPRConsent.job.push('facebook');
</script>

Keywords

FAQs

Package last updated on 03 Aug 2020

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc