Skip to content
This repository has been archived by the owner on Nov 14, 2021. It is now read-only.

Latest commit

 

History

History
46 lines (27 loc) · 3.79 KB

README.md

File metadata and controls

46 lines (27 loc) · 3.79 KB

Alternative Opt-in

An alternative opt-in cookie consent derived from cookieconsent.insites.com (see https://github.com/insites/cookieconsent/).

Please note

  • I have aimed this for a site without any marketing, tracking or other cookies, just essential.
  • I am not a GDPR expert, this is not a full solution, just an example. Full requirements need you to get consent for each type of cookie you wish to set (marketing, analytics, etc.). It is down to you to check your implementation/use meets the requirements.

What is this example?

So using the JavaScript API (JavaScript API) I have created an alternative Opt-in. Please note this is a rough example and could (a) be enchanced and cleaned up and (b) possibly added back into the original library as an alternative Opt-in method.

The Opt-in that comes with Cookie Consent is good and works. This is what it looks like:

However looking to use it with the GDPR changes and I believe it will not fit. The changes note that there needs to be a clear way to change your mind about cookies so you can easily enable or disable them. The current way to change your mind, shown below, automatically revokes your choice when you click it. What if you were just looking to see what you selected, too bad all your settings have just been revoked!

I have created an example to change this. Firstly I have replaced the dismiss button with a deny button. In other words it is no longer allow or dismiss but allow or deny so a visitor has to make a choice and we do not assume anything. I have changed the default wording slightly as I believe essential cookies are still allowed (I might be wrong!). The buttons, allow and deny now highlight which option you have selected (see below).

The second bit to this is that once an option is selected there is a pop up, the revoke button, that lets you change your choice (see below). I have overridden the code for this so that cookies are NOT deleted when you click it but that it simply display the selection bar showing your current choice. If decline is now clicked selected all current cookies are deleted unless you have deemed them essential (array in the code for that option).

How do I use it?

This is based on https://github.com/insites/cookieconsent/ so first I would suggest taking a look at their documentation. Second look in the examples folder, there is basic HTML, CSS and JS files. Most should be easy to follow.

Other libraries

NOTE

  • When deleting cookies I assume the path is '/' - you may have to change this to match your path.
  • You need to set your domain and run the script from a server.

Disclaimer

I am not a GDPR expert, this is not a full solution, just an example. Full requirements need you to get consent for each type of cookie you wish to set (marketing, analytics, etc.). It is down to you to check your implementation/use meets the requirements.