If you intend to implement Cookiebot via the Cookiebot CMP Template Gallery Tag inside Google Tag Manager (GTM), please refer to our GTM deployment guide instead.
With Cookiebot's integration to the Google Consent Mode you can respect the privacy choices of end users with minimal impact on your website's ad-based revenue stream, analytics and more.
If you're already using Google gtag.js or GTM on your website, we recommend that you add the Google Consent Mode integration to your website, to ensure you get the best use of your Google Services.
Cookiebot integrates with Google Consent Mode. Don't have a Cookiebot account yet? Sign up for your free trial today to take advantage of our powerful integration!
Benefits
Once you have implemented the integration on your website, Cookiebot will automatically signal the consent choices of your visitors to Google instead of blocking tags when not consented. The end user's granular consent will be used by Google to adjust tag behavior accordingly.
With the Google Consent Mode and the Cookiebot integration in place, Cookiebot will allow tags to run and Google will act to e.g. re-marketing and log analytics data according to the signal sent by Cookiebot.
Google describes the technical details of how supported tags changes behavior based on the end user's consent here: https://support.google.com/analytics/answer/9976101
Implementation
The Google Consent Mode is an API that Cookiebot integrates with. When you have installed the Cookiebot tag directly on your site, you can enable the Google Consent API-integration by adding the following code snippet to your website template, above the gtag.js or GTM code itself:
<script data-cookieconsent="ignore">
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag("consent", "default", {
ad_storage: "denied",
analytics_storage: "denied",
functionality_storage: "denied",
personalization_storage: "denied",
security_storage: "granted",
wait_for_update: 500,
});
gtag("set", "ads_data_redaction", true);
gtag("set", "url_passthrough", true);
</script>
data-cookieconsent="ignore"
attribute to the Consent Mode and GTM/gtag.js script tags.
Ensure adding the above code before your gtag.js or GTM code snippet to ensure that these default settings are passed to GTM before it loads.
Furthermore, if you've chosen to rename the dataLayer, please ensure that you modify the script to use the new name of the dataLayer. For example, if you renamed the dataLayer to "gtmDataLayer", the first line needs to be amended to resemble this: window.gtmDataLayer = window.gtmDataLayer || [];
You may change the values of the 5 default consent types like ad_storage and analytics_storage to 'granted' and set ads_data_redaction to 'false' if you want to default to an opt-in before the end user has submitted consent, for example allowing for a default opt-in under CCPA.
Please note that the Cookiebot always sends updated Consent Mode data to GTM, regardless of whether you have defined default settings with the above script.
If you for any reason prefer not making use of Consent Mode, you have the option to prevent Cookiebot from sending Consent Mode signals to GTM as described in Disabling Google Consent mode.
Questions?
Please reach out to us with any Google Consent Mode related questions via our support form.
To read more about Cookiebot and the Google Consent Mode and how this integration could help you get more out of your website, please see our blog post here.
Comments
0 comments
Please sign in to leave a comment.