Please note that this installation guide is valid for both Magento 1 and Magento 2. If you are using Magento 2, please note that the Miscellaneous Scripts field referenced below can be found in the following location instead: Content -> Design -> Configuration -> Edit (either the global or store depending on how many websites/stores you have) -> HTML Head -> Scripts and Style Sheets Field.
1. Implementing the Cookiebot consent dialog (cookie consent banner) in Magento:
1. In the Admin Panel, select System -> Configuration. Then in the panel on the left, under General, select Design -> HTML Head.
2. Insert the Cookiebot consent dialog script into the Miscellaneous Scripts field:
<script id="Cookiebot" src="https://consent.cookiebot.com/uc.js" data-cbid="00000000-0000-0000-0000-000000000000" type="text/javascript" async></script>
Replace the zeroes with the cbid number from the domain group where the domain is added. It is available from the 'Your scripts' tab on your Cookiebot account.
3. When complete, click Save Config:
Please note: If you have multiple websites/stores or store views, which are having different values in the Miscellaneous scripts field, then set the Current Configuration Scope in the upper-left corner to the websites/stores or store views you want to edit and clear the checkbox after Miscellaneous Scripts field so new values can be entered. This needs to be done to all, which are not using the Global scope value.
2. Implementing prior consent in Magento:
To enable prior consent (block cookies until user has consented), apply the attribute "data-cookieconsent" to all script tags setting cookies. 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. Finally change the attribute "type" from "text/javascript" to "text/plain". Scripts might be coming from the admin panel, theme files or extensions added to Magento.
In the Admin Panel: The most common places for scripts to be added are:
- System -> Configuration -> General -> Design -> HTML Head
- Static blocks
- CMS Pages
- Extension settings
Example on implementing prior consent:
1. On the Admin menu, select System -> Configuration. Then in the panel on the left, under General, select Design -> HTML Head.
2. In the Miscellaneous Scripts field:
if you are using Google Analytics, make the following change to the code:
<script> (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>
Becomes (highlighted 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>
3. When complete, click Save Config:
3. Implementing the Cookie Declaration in Magento:
1. In the Admin Panel, select CMS -> Pages. Then choose the page you want to show the Cookie Declaration on.
2. Into Content -> Show/Hide Editor, paste the Cookiebot Cookie Declaration script where you want it to appear on the page:
<script id="CookieDeclaration" src="https://consent.cookiebot.com/00000000-0000-0000-0000-000000000000/cd.js" type="text/javascript" async></script>
Replace the zeroes with the cbid number from the domain group where the domain is added. It is available from the 'Your scripts' tab on your Cookiebot account.
3. When complete, click Save Page:
Last updated: 22 June 2018
Comments
0 comments
Please sign in to leave a comment.