How to mark up cookie-setting script tags to control cookies

You can manually mark up cookie-setting script tags on your website to control cookies

The Dataships cookie banner allows users to accept cookies based on predefined categories. When they click the Accept All button, they are accepting all the underlying categories which are as follows:

  • Necessary
  • Preference
  • Statistics
  • Marketing

From the list above, it is only compliant to load necessary cookies on a website before the user provides their consent. Necessary cookies are usually security related or fundamentaly required for the site to function. 

If your website allows non-necessary cookies to load on a user's browser you will need to manually mark up cookie-setting script tags to prevent this. When you mark up cookie-setting script tags that script will only load when a specified category of cookies has been allowed by the user e.g. load Google Analytics when a user accepts the statistics category of cookies.

 

In order to manually mark up a script, you need to:

1. First locate the script which is setting the particular cookie.

2. Once, you have identified the script, apply the attribute "data-cookieconsent" to cookie-setting script tags on your website.

3. Set the comma-separated value to one or more of the cookie categories "preferences", "statistics" and "marketing" in accordance with the types of cookies being set by each script.

4. Check the Cookie Declaration area of the Privacy Centre for more information.

5. Finally, change the attribute "type" from "text/javascript" to "text/plain".

 

See below example of modifying an existing Google Analytics Universal script tag (changes are in bold):

<script type="text/plain" data-cookieconsent="statistics"> 
(function(i,s,o,g,r,a,m){
i['GoogleAnalyticsObject']=r;
i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();
a=s.createElement(o),m=s.getElementsByTagName(o)[0];
a.async=1;
a.src=g;
m.parentNode.insertBefore(a,m)})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-00000000-0', 'auto');
ga('send', 'pageview');
</script>

 

Please reach out to Customer Support if you have any questions on the above who will be able to bring you through this in further detail.