You may still be using and preferring the manual implementation and markup option.
In that case the below guide may still be relevant for you.
For automatic cookie blocking make sure that your cookie consent banner script includes the data attribute data-blockingmode="auto"
and that async
is removed from the script example below.
Manual implemention of the Cookiebot consent dialog in a Joomla site:
Add your personal Cookiebot script for the consent dialog (available under the tab 'Your scripts' in the Cookiebot Manager) to your template's index.php file inside the head tag and before the jdoc head tag (<jdoc:include type="head"/>
), e.g. (highlighted in bold):
<head>
<script id="Cookiebot" src="https://consent.cookiebot.com/uc.js" data-cbid="00000000-0000-0000-0000-000000000000" type="text/javascript" async></script> <jdoc:include type="head"/> </head>
As an alternative you can insert the script on all pages dynamically with the addScript function:
$cookieTag .= '<script id="Cookiebot" src="https://consent.cookiebot.com/uc.js" data-cbid="00000000-0000-0000-0000-000000000000" type="text/javascript"></script>';
$document = JFactory::getDocument();
$document->addCustomTag($cookieTag);
Implementing prior consent on Joomla plugins, extensions, components and modules:
To enable prior consent (block cookies until the 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 Asynchronous Google Analytics plugin:
Edit the plugin code directly by going to the root file (eg. joomla2.5) -> plugin -> select the plugin file "GoogleAnalytics.php" and edit it.
$javascript .= "<script type=\"text/javascript\">"
becomes:$javascript .= "<script type=\"text/plain\" data-cookieconsent=\"statistics"\>"
If you are using Google Analytics Universal, make the following change to the code in such a way that this:
<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');
becomes this (highlighted):
<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');
Showing your cookie declaration in full on a separate Joomla page:
If you want to show your cookie declaration in full on a seperate page or as part of your privacy policy, embed your cookie declaration script tag as described below.
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 behavior you need to enable JavaScript in the editor.
Comments
0 comments
Please sign in to leave a comment.