Websites using Google Tag Manager (GTM) can easily deploy Cookiebot by following these step-by-step instructions.
In this guide, we will show you how to:
In this guide, we will show you how to:
- Implement the cookie consent banner
- Control cookie-setting tags
- Display the cookie declaration on a subpage
We assume that you have already created a GTM account, created a website container in GTM and added the GTM container snippet to your website as required: https://support.google.com/tagmanager/answer/6103696
1. Implementing the cookie consent banner in GTM
In your GTM container, click "Templates" > "Tag Templates" > "Search Gallery" and select "Cookiebot CMP" from the list of community tag templates. Click "Add to workspace" and confirm by clicking "Add".
Create a new tag by clicking "New" > "Tag Configuration" and select "Cookiebot CMP" from the list of standard tag types.
In the "Cookiebot ID" field, copy in the ID from the 'Your Scripts' tab under your account on cookiebot.com.
In the "Cookiebot ID" field, copy in the ID from the 'Your Scripts' tab under your account on cookiebot.com.
Choose "All pages" as trigger and apply a name to your tag at the top of the configuration page, e.g. "Cookiebot". Click "Save" to create the tag.
This is what your tag configuration should look like (except for the value of the Cookiebot ID):
Make sure that you have registered and saved the domain name(s) of your website(s) in Cookiebot.
2. Controlling cookies
To honor the visitor's consent, you need to define the logic that controls the behavior of cookie-setting tags on your website.
In your GTM container, click "Templates" > "Variable Templates" > "Search Gallery" and select "Cookiebot Consent State" from the list of community variable templates. Click "Add to workspace" and confirm by clicking "Add".
Now, add a variable and name it "Cookie Consent" by creating a new Variable and selecting "Cookie Consent State" from the list of standard variables. No configuration is available or needed.
Then, add the following triggers to your GTM configuration:
- Event Name: cookie_consent_preferences, Event Type: Custom Event, Fires On: Some Custom Events, Filter: Cookie Consent - contains - preferences
- Event Name: cookie_consent_statistics, Event Type: Custom Event, Fires On: Some Custom Events, Filter: Cookie Consent - contains - statistics
- Event Name: cookie_consent_marketing, Event Type: Custom Event, Fires On: Some Custom Events, Filter: Cookie Consent - contains - marketing
Tags that are setting cookies within one of these three categories (see the scan report from Cookiebot if you are in doubt) must only be triggered when the user has consented to the relevant category/categories. For this, replace the existing Firing Trigger on each cookie-setting tag with the relevant cookie-trigger, e.g. "Cookie Consent Statistics" for Analytics.
If a tag requieres more than one trigger, e.g. multiple cookie-categories, then create a new trigger of type Trigger Group and add all the relevant cookie-triggers and any other trigger and set "This trigger fires on" to "All conditions". Replace the tag's existing trigger with this Trigger Group.
3. Implementing the cookie declaration
To make available an option for the user to change or withdraw consent, implement Cookiebot's 'Cookie Declaration' on a page of your own choice by embedding the following script tag directly into the source of the page and position within the page where you want the cookie declaration to be displayed (replace 00000000-0000-0000-0000-000000000000 with your own Cookiebot ID):<script id="CookieDeclaration" src="https://consent.cookiebot.com/00000000-0000-0000-0000-000000000000/cd.js" type="text/javascript"></script>
Make sure to link to the page that embeds the declaration from all pages on your website, e.g. in the website template footer.
Other ressources
For instructions on how to make the cookie banner change language depending on which (language) part of your website a visitor navigates, please see Multilingual support when using GTM.
When you implement Cookiebot using GTM, Cookiebot will also be able to control tags not set from GTM, i.e. script tags that are inserted directly in your website template. Just mark up such tags for 'prior consent' as described in our general implementation tutorial.
See also our blog post: Google tag manager and GDPR
Comments
4 comments
Hello,
I maintains many wix website but this I followed the procedure but it does not work.
The cookies content banner does not appear. Why ?
Hello,
I have the same problem with drupal. I'm using manual blocking, is it correct?
Thank you
Hi Speralta
How did you implemented GTM in drupal? I have followed same steps described in this page.
And i could see JS variable "Cookiebot.consent" is set according user accept values and "dataLayer" event also triggering perfectly in all pages.
Does this means its working fine? How can i confirm that GTM works perfectly after user accepts statistics consent and GTM doesnt when user doesn't provide consent?
Hi,
I have been able to solve the problem, thank you very much.
Please sign in to leave a comment.