gdpr cookie consent google analytics - Free Download GDPR and Cookie Consent Modal for Google Analytics - jQuery CookieKit

Free Download GDPR and Cookie Consent Modal for Google Analytics – jQuery CookieKit

Posted on

This time I will share jQuery Plugin and tutorial about GDPR and Cookie Consent Modal for Google Analytics – jQuery CookieKit, hope it will help you in programming stack.

gdpr cookie consent google analytics - Free Download GDPR and Cookie Consent Modal for Google Analytics - jQuery CookieKit
File Size: 7.29 KB
Views Total: 395
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

CookieKit is an easy-to-use jQuery plugin that displays a GDPR and Cookie consent modal when users first visit your site and dynamically inserts Google Analytics tag into the document when they accept the data collection policy.

More about GDPR:

How to use it:

1. Load the jquery.cookiekit.js JavaScript library after jQuery.

1 <script src="/path/to/cdn/jquery.min.js"></script>
2 <script src="/path/to/jquery.cookiekit.js"></script>

2. Initialize the CookieKit and insert your own Google Analytics Tracking ID. That’s it.

1 $(document).cookieKit({
2   id:'UA-XXXXXXXX-1'
3 });

3. Change the language of the GDPR and Cookie Consent Modal. Default: ‘fr’.

1 $(document).cookieKit({
2   id:'UA-XXXXXXXX-1',
3   lang: 'en'
4 });

4. Customize the appearance of the GDPR and Cookie Consent Modal.

01 $(document).cookieKit({
02   modal: {
03     hrColor: '#b3b3b3',
04     fontColor: '#3c3c3c',
05     backgroundColor: '#e9e9e9'
06   },
07   button: {
08     acceptColor: '#0a9919',
09     acceptColorHover: '#076212',
10     refuseColor: '#8a0a0a',
11     refuseColorHover: '#550505',
12   },
13 });

5. Assign a unique ID to the modal. Default: empty.

1 $(document).cookieKit({
2   id:'UA-XXXXXXXX-1',
3   id: 'myID'
4 });

6. Set the cookie name, path, and expiration date.

1 $(document).cookieKit({
2   id:'UA-XXXXXXXX-1',
3   cookie: {
4     name: 'cookiekit',
5     days: 10,
6     path: '/'
7   },
8 });