How to add a EU Cookie Consent Script

Home Forums Porto – Responsive HTML5 Template FAQ’s How to add a EU Cookie Consent Script

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #10007851
    Support
    Keymaster

    1) Download this file: http://www.primebox.co.uk/files/uploads/jquery.cookiebar.zip

    2) Unzip the file and put in the vendor folder.

    3) Add it in the HTML file:

    CSS:

    JS:

    4) Initialize the Script:

    (js/custom.js)

    $(document).ready(function(){
    	$.cookieBar({
    		message: 'We use cookies to track usage and preferences',
    		acceptButton: true,
    		acceptText: 'I Understand',
    		declineButton: false,
    		declineText: 'Disable Cookies',
    		policyButton: true,
    		policyText: 'Privacy Policy',
    		policyURL: '/privacy-policy/',
    		autoEnable: true,
    		acceptOnContinue: false,
    		expireDays: 365,
    		forceShow: false,
    		effect: 'slide',
    		element: 'body',
    		append: false,
    		fixed: false,
    		bottom: false,
    		zindex: '',
    		redirect: '/'
    	});
    });

    5) Change CSS:
    (css/custom.css)

    #cookie-bar {
    	background-color: #171717;
    	height: 40px;
    	z-index: 99999;
    	padding: 8px 0;
    }

    6) How to test on your code if the cookies were accepted:

    if(jQuery.cookieBar('cookies')){
      // Cookies were accepted!
    }

    7) More information: http://www.primebox.co.uk/projects/jquery-cookiebar/


Viewing 1 post (of 1 total)

This topic is marked as "RESOLVED" and can not rceive new replies.