Implementing the Cookiebot consent dialog in a Prestashop site:
<head>
<script
id="Cookiebot"
src="https://consent.cookiebot.com/uc.js"
data-cbid="00000000-0000-0000-0000-000000000000"
type="text/javascript"
async
></script>
...
</head>
Please note: If you copy the Cookiebot script tag directly from the Cookiebot Manager, you may need to move the 'cbid'-attribute inside the URL because Prestashop may strip the attribute 'data-cbid' from the default script. Without the 'cbid' fragment, Cookiebot will not display on your site when served through Prestashop.
Therefore, you should insert a script looking like this instead:
<script
id="Cookiebot"
src="https://consent.cookiebot.com/uc.js?cbid=00000000-0000-0000-0000-000000000000"
type="text/javascript"
async
></script>
where you replace the zeroes with the cbid from the ‘Your scripts’ tab i the Cookiebot Manager, under the particular domain group where the domain is located.
Implementing prior consent on Prestashop plugins, addons and modules:
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 of the attribute to one or more of the three types of cookies: "preferences", "statistics" and "marketing" in accordance with the types of cookies being set by each script. Finally change the script tag attribute "type" from "text/javascript" to "text/plain".Example on the Google Analytics Module:
Edit the module code directly by going to the module file "ganalytics.php" and edit it.
Make the following addition (bold highlight) to the file under the function "_getGoogleAnalyticsTag":
protected function _getGoogleAnalyticsTag($back_office = false)
{
return '
<script type="text/plain" data-cookieconsent="statistics">
(window.gaDevIds=window.gaDevIds||[]).push(\'d6YPbH\');
(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\', \''.Tools::safeOutput(Configuration::get('GA_ACCOUNT_ID')).'\', \'auto\');
ga(\'require\', \'ec\');
'.($back_office ? 'ga(\'set\', \'nonInteraction\', true);' : '').'
</script>';
}
Showing your cookie declaration in full on a Prestashop CMS page:
In the content editor for the page or article where you want to show your cookie declaration in full, switch to html view mode and paste the script code where you want the declaration to show, e.g.:
<script
id="CookieDeclaration"
src="https://consent.cookiebot.com/00000000-0000-0000-0000-000000000000/cd.js"
type="text/javascript"
async
></script>
If you are using a rich text/WYSIWYG editor, the script above may be stripped out when saving the page. To avoid this behaviour you need to enable Javascript in the editor.
Comments
0 comments
Please sign in to leave a comment.