Google Tag Manager – cookie consent – GDPR compliant with Cookiebot

Are you a fan of Google Tag Manager and looking for a way to configure GDPR compliant cookie consent?
Combining Google Tag Manager and Cookiebot may be a solution you want to consider.

If your website drops cookies other than those necessary for its basic functionality, then you must obtain prior consent of the user before collection and processing of data.

As Google Tag Manager has “Tag Templates” in which you can find the “Cookiebot CMP” template, you can easily set up a proper consent mechanism for using cookies and trackers on your website.

Combine the Cookiebot technology with one of the CookieInfo custom banner designs and your website has a GDPR proof consent management mechanism with high converting opt-in percentages on your cookie banner. This ensures you respect privacy while getting the most out of your online goals.

In the next steps we will show you how to:

  1. Implement the cookie banner
  2. Implement Prior-consent
  3. Show the cookie statement on a specific page on your website

We are assuming you have created a Google Tag Manager account, created a website container and implemented the GTM code on your website. More information

Combine the use of Google Tag Manager with automatic cookie blocking by Cookiebot to get the best of both worlds. If you want to use automatic cookie blocking together with GTM please check out this knowledgebase article: Google Tag Manager and automatic cookie blocking

**** If you want to use automatic cookie blocking together with GTM please check out this knowledgebase article: Google Tag Manager and automatic cookie blocking

In the GTM container click on “Templates” in the left menu. Then in the “Tag Templates” panel click the button “Search Gallery”:

Type “Cookiebot” in the searchbox and select the template “Cookiebot CMP” from the results:

Then click the button “Add to workspace”. You will see a warning dialog where you will be asked to allow Cookiebot to add scripts in your website. Click “Add”.

Now create a new tag by clicking on Tags in the left menu and the click on the button “New”. Click on “Tag configuration”, and look for the “Cookiebot CMP” under “Custom” in the “Choose tag type” screen. Select this tag:

Fill in the field “Cookiebot ID” with your personal Cookiebot code. (Which you will find in the Cookiebot manager , tab ‘Your scripts‘). In the trigger box, add the trigger “All pages” to make sure the tag is fired on every page. Name the tag (for example “Cookiebot CMP”) and hit the save button.

Your screen should look like this:

To honor the visitor’s consent, you need to define the logic that controls the behavior of cookie-setting tags on your website.

Important: This is not applicable for the tags below if you useGoogle Consent Mode
– Google Ads (including Google Ads Conversion Tracking and Remarketing)
– Floodlight
– Google Analytics
– Conversion Linker
With Consent mode , the behavior of these tags is automatically changed according to the users consent.

In GTM click on the left menu on “Templates” and then in the “variable templates” section click on the button “Search Gallery”. Look for the variable template “Cookiebot Consent State” and click on it and then click “Add to workspace”:

Again you will see a warning dialog where you have to give Cookiebot permission to add scripts to your website. Click on “Add”. After that click on the “New” button in Variables -> User Defined Variables.

Select “Cookiebot Consent State” from the list of variables:

This variable does not need any configuration. Click on “Save” and name it “Cookie Consent“.

After this we need to create three triggers:

  1. Event Name: cookie_consent_preferences,
    Event Type: Custom Event,
    Fires On: Some Custom Events,
    Filter: Cookie Consent contains preferences
  2. Event Name: cookie_consent_statistics,
    Event Type: Custom Event,
    Fires On: Some Custom Events,
    Filter: Cookie Consent contains statistics
  3. Event Name: cookie_consent_marketing,
    Event Type: Custom Event,
    Fires On: Some Custom Events,
    Filter: Cookie Consent contains marketing

To do this click on “Triggers” in the left menu. Select a new trigger of type “Custom event” and fill in the fields according to the information above. A trigger will then look like this:

After creation of the three triggers, you can add them to the tags which create cookies from one of these categories. (also see the scan report when in doubt). This wil look something like this:

When a tag needs consent from multiple categories, you can create a triggergroup and place a collection of triggers in there. Below an example of a triggergroup:

This script is inserted in the HTML of the page where your cookie declaration has to be visible. If you don’t have such a page create a new page for it. Replace the green code below for the code from the cookiemanager. (Which you will find in the Cookiebot manager , tab ‘Your scripts‘):

<html>
<head>
...
</head>
<body>
<h1>Cookie verklaring</h1>
<script id="CookiePolicy" src="https://consent.cookiebot.com/00000000-0000-0000-0000-000000000000/cd.js" type="text/javascript" async></script>
</body>
</html>

You can let your web developer implement these scripts. Just send him/her the scripts and the information on this page.

Are you interested to customize the Cookiebot custom banner template or styling? Don’t have the means or knowledge to style the Cookiebot custom banner template or develop a cookie banner design by yourself?

If you want a cookie banner that reflects your corporate identity or if you are reliant on high opt-in percentages on cookies and trackers maybe the CookieInfo custom banner designs are of interest for your.

We have developed these cookie banners in close cooperation with the CookieInfo community to work perfectly on top of the Cookiebot technology. Now you can not only benefit from a smooth Google Tag Manager cookie implementation, but also tailor the cookie banner to your needs.

Cookiebot Custom banners

Are you interested in customizing the standard Cookiebot cookie banner?