Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gdpr-consent

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gdpr-consent

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

  • 1.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
104
increased by136.36%
Maintainers
1
Weekly downloads
 
Created
Source

NPM version QC Checks

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 */,
		AcceptAllCta: true /* Show the accept all button*/,
		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");

	/* Add Vidéos */
	GDPRConsent.job.push("vimeo");
	GDPRConsent.job.push("youtube");
</script>

Keywords

FAQs

Package last updated on 02 Nov 2022

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