GDPR Compliant Cookie Consent Banner In JavaScript – GlowCookies

Category: Javascript , Recommended | October 24, 2020
Author: manucaralmo
Views Total: 274 views
Official Page: Go to website
Last Update: October 24, 2020
License: MIT


GDPR Compliant Cookie Consent Banner In JavaScript – GlowCookies


GlowCookies is a plain JavaScript library that displays a customizable, GDPR compliant cookie consent banner and automatically blocks third-party tracking codes (like Google Analytics, Facebook Pixel, etc) if the user rejects cookies.

How to use it:

1. Download the package and place the cookiesGlow.js library at the end of the document.

<script src="v1/cookiesGlow.js"></script>

2. Insert your own tracking codes as follows. The library currently supports Google Analytics, Facebook Pixel, and Hotjar.

var AnalyticsCode = "UA-XXX-XX";
var FacebookPixelCode = "XXXXXX";
var HotjarTrackingCode = "XXXXXXX";

3. Specify the path to your own policy page. That’s it.

var linkHref = "";

4. Customize the appearance of the cookie consent banner.

// texts
var btn1Text = "Accept";
var btn2Text = "Reject";
var bannerDescription = "We use cookies for analytics, performance, security, advertising and social media. You consent to our cookies if you continue to use our website.";
var linkTexto = "More Info";
var manageText = "Cookies";

// colors
var btn1Background = "#E8E8E8"; 
var btn1Color = "#17663D";
var btn2Background = "#E8E8E8";
var btn2Color = "#17663D";
var bannerBackground = "#17663D";
var descriptionColor = "#fff";
var manageColor = "#E8E8E8";
var manageBackground = "#17663D";

// Extras
var border = "yes" // or "none"
var bannerPosition = "right" // or "left"


v1.7.1 (10/24/2020)

  • Code improvements and bug fixes

You Might Be Interested In:

Leave a Reply