Introduction
Google Tag Manager allows you to configure Additional Consent Checks. This essentially allows you to configure the tag to require permission for a specific storage type to fire a tag.
This require the use of Google Consent mode though, which will be enabled automatically if you have deployed Cookiebot using the Cookiebot CMP tag from Google Tag Manager's template gallery. If you implement Cookiebot in any other way, you will need to add a supplementary script as described in Cookiebot and Google Consent Mode.
There are alternative methods to conditionally load tags though. This guide will describe alternative options and provides instructions in their use.
Cookiebot will send consent data regardless of whether Consent Mode is enabled or not. This ensures that you still can conditionally load tags that require consent, in the form of the following three Custom Events:
- Event name:
cookie_consent_preferences
- Event name:
cookie_consent_statistics
- Event name:
cookie_consent_marketing
The process of setting up a consent trigger requiring consent for statistical/analytics cookies is identical to setting up the cookie_consent_update
trigger as described in step 2.1 of the Google Tag Manager deployment guide. The result should look similar to this:
Using the Cookiebot Consent State variable
In the Template Gallery you can find a variable that can be used to determine if consent has been given for a certain cookie category (preferences, statistics, marketing).
The variable essentially reads the consent state from the CookieConsent cookie set by the Cookiebot script when a visitor submits consent via the banner, constructs a string, and returns it.
If no consent has been given the variable will return "|". If consent has been given, then for each category that has been accepted the category name and a pipeline symbol as a separator is added to the string. So for a full opt-in the variable returns: "|preferences|statistics|marketing|".
To import the Cookie Consent variable perform the following actions:
Click "Add to workspace" and confirm by clicking "Add".
You will now be able to use this variable in a condition to fire a tag.
Generally speaking, you will need to switch "This trigger fires on" from "All..." to "Some..." and add the following condition to a trigger:
Cookie Consent ➟ contains ➟ [category]1
A trigger using the variable could look similar to this:
1 Use one of the following values: "preferences", "statistics", or "marketing"
Comments
0 comments
Please sign in to leave a comment.