Blocking cookies
This guide will show you how to manually block all your current cookies, such they are only activated when users have given the correct consent.
legal.js currently uses manual categorisation to properly block cookies that are set on your website, so you must make changes to your HTML for blocking to work. In future, an automatic option will be available that will not require this step. This guide outlines the concept of blocking cookies manually, by example of a Google analytics script, but the concept should be easily transferrable to any other script.
Necessary cookies will always be enabled, so there is no need to categorise scripts that set them, unless those scripts also set cookies in another category. If that applies to a script on your website, you should categorise the script appropriately (e.g. as setting analytics cookies).
Step 1: Get an overview
To ensure that cookies set by scripts are properly blocked or allowed, you must update how you include scripts on your website. They will normally look something like this example for the Google analytics snippet:
Step 2: Edit scripts
Now that you know which scripts you have on your site, you must edit each one to the following:
Add the
type
attribute with valuetext/plain
(or changing it, if already present)Add a
data-cookieconsent
attribute with a value of eitheranalytics
ormarketing
based on the type of cookie the scripts set.
Both these changes are applied to the <script>
-tag, like so:
The example above would look like this when correctly updated to add the extra attributes for analytics to the scripts:
Done!
Congratulations on completing your first step towards collecting compliant cookie consent. Pat your self on the back and know that our privacy mascot Li is proud of you.
Last updated