As you may already know, cookies can perform a number of useful tasks such as recording your visitor IP address, logging personal settings or track user behaviours from page to page. Since the inception of the 2002 ePrivacy Directive, also known as ‘The Cookie Law’, some webmasters placed simple banners or popups stating that cookies are sent with a simple consent button for users to click. Fast-forward to 25th May 2018 with the birth of the General Data Protection Regulation (GDPR) and updated ePrivacy Directive (ePR), the quick and dirty methods of sending cookies without warning site visitors are no longer acceptable.

The team at CJT have eased the process of adding a cookie consent script on your website. And not only made it easy, but also made it easy to customise to your website theme and colours. Thanks to the team at InSights and a number of other developers (see below in the Credits), you are able to add a cookie consent script with absolute ease – check out what you can do below:

  • customise the banner colours
  • adjust the banner position
  • add your own cookie consent message
  • change the privacy policy URL
  • change the button text
  • change the cookie consent theme

There are even a number of advanced features to help with full GDPR compliance, including:

  • adding GeoLocate to only show the cookie consent banner to visitors residing in countries of the European Union
  • create callback hooks for showing/accepting/revoking the cookie consent banner
  • support for different types of compliance, giving you the flexibility to obey even the strictest cookie laws

Consent My Cookie is a lightweight JavaScript plugin for alerting users about the use of cookies on your website.

CJT has made it super simple to import into your website with just a few clicks. It will automatically add them to three code blocks, where you can customise the settings, modify the CSS, and change the main Consent My Cookie script itself. We have provided instructions below so follow carefully.

Download

Steps

  1. Click and download the consent-my-cookie.zip file above
  2. If your browser or operating system automatically unzips the file, please compress it back into a .zip file
  3. Go to the Import / Export feature of CSS & JavaScript Toolbox PLUS.  If you do not own CJT PLUS, then grab your copy here: CSS & JavaScript Toolbox PLUS
  4. Click the Import tab
  5. Upload the consent-my-cookie.zip file
    1. For the code block called Consent My Cookie, go to the Assignment Panel and select the Aux tab. Click the checkbox called Entire Website and then click Save
    2. Repeat the steps above for the Consent My Cookie – CSS code block (i.e. select the Aux tab and click Entire Website). Click Save
    3. Repeat the steps above for the Consent My Cookie – JS code block (i.e. select the Aux tab and click Entire Website). Again click Save
  6. Refresh your website and then view the result

Additional Notes

  • After you have clicked the button to consent to cookies being sent, if you want to test the script again, then you will need to delete the cookie in your browser cache. This can be done in the browsers developer tools (e.g. Inspector).
  • We have added customisation instructions as code comments, which is quite easy to follow. If you want to check the advanced features and examples such as the callback hooks for enabling or disabling cookies, or even view the script API, then click: Consent My Cookie Documentation and API.
  • The CSS & JavaScript Toolbox Free version on WordPress.org does not have the Import/Export feature, so you would need to create the code blocks and add those scripts in manually. If you have purchased CSS & JavaScript Toolbox PLUS, you will find the Import / Export feature by hovering over the CSS & JavaScript Toolbox PLUS dashboard link on the WordPress dashboard main menu.

Credits

Cookie Consent v3
Alex Morley-Finch – JavaScript
Piiu Pilt – JavaScript
Oliver Emberton (@oliveremberton) – a couple of lines of CSS, maybe

Cookie Consent v2
David Ball (@drball) – CSS / themes
Adam Hutchinson (@adjohu) – JavaScript

Damian Baker on EmailDamian Baker on FacebookDamian Baker on TwitterDamian Baker on WordpressDamian Baker on Youtube
Damian Baker
Developer & Designer @ Wipeout Media
Damian (Damo) is a graphic designer, guitar & drum music tutor, fitness-freak, developer & solutions provider from Perth in Western Australia. I've built countless websites, co-developed a FileMaker solution called Teacher's Companion and two WordPress plugins called CSS & JavaScript Toolbox and Easy Code Manager.
3 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *