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" ,
cookieName: "tarteaucitron" ,
timeExpire: 31536000000 ,
websiteName: "Les Jours" ,
AcceptAllCta: true ,
moreInfoLink: true ,
mandatory: false ,
});
</script>
Add services
<script type="text/javascript">
GDPRConsent.job = GDPRConsent.job || [];
GDPRConsent.user.googletagmanagerId = "GTMID";
GDPRConsent.job.push("googletagmanager");
GDPRConsent.user.gtagUa = "GAID";
GDPRConsent.user.gtagInitOptions = {};
GDPRConsent.job.push("gtag");
GDPRConsent.job.push("twitter");
window.fbAsyncInit = function () {
FB.init({});
};
GDPRConsent.job.push("facebook");
GDPRConsent.job.push("vimeo");
GDPRConsent.job.push("youtube");
</script>