Google has recently mandated the adoption of Consent Mode version 2 for integrating advertising functionalities across various Google products through consent management platforms. This tutorial aims to guide you through the process of installing Consent Mode v2 using Cookiebot alongside Google Tag Manager.
From establishing consent banners to configuring trigger mechanisms based on user consent for GTM tags, this comprehensive walkthrough ensures a seamless integration process.
Cookiebot Setup Guide:
At first, search on google “Cookiebot” website by
visiting: https://www.cookiebot.com/
If you’re looking for a consent management platform with Google Consent Mode features, Cookiebot is one option among many. They provide a generous 14-day free trial and also offer a free plan for a single domain website with up to 50 subpages.
Go to Pricing → Start your free trial to get started.
Once you have signed up, go to the Domains section and input the domain name of your website where you want to enable cookie consent.
Afterward, proceed to the Configuration section to customize the consent banner that you wish to display on your website.
Here is our cookie consent banner.
Because my website requires a login, I added the cookies and trackers manually. But for most websites, you’d simply scan your site, and the tool would automatically detect the cookies and trackers.
Check out our How to Create a GTM
Finally, our website has Google Tag Manager installed. Currently, we have four tags running that we want to place under the Consent Management Platform and consent mode.
How to Install Consent Mode V2 in Google Tag Manager
In our Tags section, click New.
Select the Tag Configuration and open the Community Template Gallery.
Search for Cookiebot and select the Cookiebot CMP tag template.
Click Add to Workspace. Confirm by clicking Add.
Next, we require the Cookiebot ID, which can be obtained from Cookiebot in the Implementation section. Simply copy the Cookiebot ID from there.
Paste the Cookiebot ID in the allocated spot and click Enable Google Consent Mode.
Activating this option will establish the connection between our consent banner, Google Tag Manager, the data layer, and the Gtag utilizing the Consent Management API. This ensures that all the necessary calls are automatically set up.
Once you’ve enabled Google consent mode, all that remains is to select our default consent state. What should our state be when the consent popup loads, before any tags are triggered?
You have the option to set different consent states for various regions or apply a single default state globally.
To do this, click on “Add region.” Then, leave the region field empty and ensure all default states are set to “Denied.” Finally, click on “Add” to save this default consent state.
Let’s add a name to the tag and add a trigger by clicking Triggering.
We’ll use the Consent Initialization – All Pages trigger because we want this tag to fire before any other tags.
Save the tag and enter the Preview mode.
Put in your website’s domain and connect the Tag Assistant to your site. Your website will open in another tab.
Install This Extension: Tag Assistant
Here we go! We get our consent popup where we can choose the different cookie categories we can allow or deny. Click Allow All.
Let’s examine the Tag Assistant at this point. We’ll observe various calls present.
One of these is the initial Consent event, which includes the consent calls made to the Gtag via the consent mode API.
All our other tags fire at an earlier event, the Container Loaded event.
We must update the triggers of our tags to ensure they activate once the user has made their consent selection. Utilizing the consent mode, we can link GTM to these consent calls through the consent overview.
Connecting GTM Tags to the Consent Management Platform
Inside Google Tag Manager, go to Admin → Container Settings.
Under additional settings, enable Consent Overview.
Now, we can utilize specific triggers, similar to new triggers, and attach them to the tags.
In the Tags section, click on the “New” button next to “New,” which will open the consent overview.
Here, you will see which tags have the new configuration of the consent overview applied to them, and currently, none of our tags have this configuration applied yet.
Full Video Tutorial:
How to Install Google Consent Mode V2
Final Summary
So, those are the steps for installing consent mode v2. Initially, we covered the Cookiebot setup and how to set up your consent banner on your website.
Next, we learned how to implement the basic mode, where we prevent tags from firing based on the user’s selection. Finally, we utilized the advanced mode to send cookie-less pings when the user denies consent.
However you choose to implement it, it’s crucial to thoroughly test your setup to ensure that it complies with the different consent settings provided by the user. Once you’re confident with your setup, publish your tags live, and you’re good to go!