If you need your domain to support more than one data protection legislation, for example GDPR and CCPA, you can configure the Cookiebot script to display different banners, depending on the visitor's location.
Step 1: Configure Domain Groups in the Cookiebot Admin/Manager
To be able to display different banners on the same domain, additional Domain Groups need to be created (one for each additional banner variant). The additional Domain Groups will function as separate configurations in terms of banner template, behavior, functionality, styling and content.
You don't have to make any changes to your existing Domain Group(s).
Only one domain group should contain the domain to which you want to apply multiple banners. This is the primary domain group where scans, cookie classification and reporting are maintained.
Step 2: Implement the configuration on your website
Now that we have our alternative banner configurations ready, we need to tell the Cookiebot script which banner to use, depending on the user's location.
Create a new Custom HTML tag and add this content to it:
<script> !function() { var c = document.scripts[0], s = document.createElement("script"), primary = "01234567-89ab-cdef-0123-456789abcdef", secondary = "{'region':'us-06','cbid':'abcdef01-2345-6789-abcd-ef0123456789'}"; s.type = "text/javascript"; s.id = "Cookiebot"; s.src = "https://consent.cookiebot.com/uc.js?cbid=" + primary; s.dataset.georegions = secondary; c.parentNode.insertBefore(s, c); }() </script>
You will obviously need to replace the placeholder value of cbid with your own Domain Group serial-number. You can find this on the "Your scripts" tab.
Similarly, you can find the serial-number for the alternate banner in the domain group you intend to use as an alternative configuration.
AA in the value for georegions represents the country code of the country you want to display the alternate banner for. For example NL for The Netherlands, FR for France, and so on - Please find a complete list of REGION_IDs in this article.
Here again the serial number is specific to the domain group with the banner you would want to display.
Assign the Consent Initialization - All Pages when you have created the tag.
Keep in mind that since you will not be using the Cookiebot CMP tag, Consent Mode will not be enabled by default.
If you wish to make use of it, you will have to add this script inline above the GTM script, or in the the tag you just created, above the script that constructs the Cookiebot script tag:
<script> !function(w,l){w.gtag=function(){(w[l]=w[l]||[]).push(arguments)}} (window,"dataLayer") gtag("consent", "default", { ad_storage: "denied", analytics_storage: "denied", functionality_storage: "denied", personalization_storage: "denied", wait_for_update: 500 }); gtag("set", "ads_data_redaction", true); </script>
Here too, you can include separate rules for specific regions.
Essentially you will add rules for the desired region after the general default rules are set.
Only the values that deviate from the general ones need to be defined.
For example, if you want tags that require consent for cookies in the preferences category to load prior consent for Californian users, this is how you would configure that:
<script>
!function(w,l){w.gtag=function(){(w[l]=w[l]||[]).push(arguments)}}
(window,"dataLayer")
gtag("consent", "default", {
ad_storage: "denied",
analytics_storage: "denied",
functionality_storage: "denied",
personalization_storage: "denied",
wait_for_update: 500
});
// California specific settings
gtag("consent", "default", {
functionality_storage: "granted",
personalization_storage: "granted",
region: ['US-CA']
});
gtag("set", "ads_data_redaction", true);
</script>
Add multiple alternative configurations for different regions:
You can add more than one alternative banner or configuration by listing region and CBID pairs as comma-separated values inside the georegions variable as shown here:
secondary = "{'region':'us-06','cbid':'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa'}," + "{'region':'nl','cbid':'bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb'}";
You can also define groups of countries that use a specific banner, by specifying multiple country ISO codes separated with commas:
secondary = "{'region':'us-06','cbid':'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa'}," + "{'region':'nl','cbid':'bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb'}," + "{'region':'at,de,dk','cbid':'cccccccc-cccc-cccc-cccc-cccccccccccc'}";
Comments
1 comment
I have Cookiebot successfully implemented using the Cookiebot CMP Tag in Google Tag Manager. Is there a way to configure that tag to allow for using multiple banners based on region?
Do I have to stop using that Tag in order to implement multiple banners?
Please sign in to leave a comment.