Google Consent Mode Implementation Instructions

Google allows the use of its own consent mode by including APIs to control tag cookie storage based on user consent choices without disabling services provided by Google, such as Google Analytics or Google Ads. 

Google Consent Mode applies to the following products deployed using either the global site tag (gtag.js) or Google Tag Manager (GTM):

  • Google Ads
  • Floodlight
  • Google Analytics
  • Conversion Linker

CookieScript has full integration with Google Consent Mode

  • Tag Manager Community Template available
  • Integrated with consent update calls
  • Integrated with consent default calls
  • Supported consent types:
    • ad_storage
    • analytics_storage
    • functionality_storage
    • personalization_storage 
    • security_storage

How to implement Google Consent Mode with CookieScript GTM Tag template (recommended)

This is the easiest implementation since it requires no coding whatsoever. However, it only applies to users who are using Google Tag Manager (GTM). If you are not using Google Tag Manager, skip to the next section with manual Consent mode implementation.

We have created a GTM Tag template that does all the necessary coding for you. Just follow the steps to deploy CookieScript using a community Tag Template and the Tag will do all the magic. 

Google Consent Mode should be enabled in settings too. Go to your banner settings > Behaviour tab > Enable Google Consent Mode. You can optionally change a category that allows Ads Storage, Analytics Storage, Functionality Storage, Personalization Storage, and Security Storage in Google Consent mode. 

How to implement Google Consent Mode manually

In order to enable Google Consent Mode, include this code snippet just before including gtag.js or GTM snippet:

<script>

window.dataLayer = window.dataLayer || [];

function gtag() {

dataLayer.push(arguments);

}

gtag("consent", "default", {

ad_storage: "denied",

analytics_storage: "denied",

wait_for_update: 500

});

gtag("set", "ads_data_redaction", true);

</script>


Implementing Google Consent Mode manually, you must include this code before your gtag.js or GTM code snippet. In case your dataLayer was renamed, you should also rename it in the code above. If you implement Google Consent Mode with the CookieScript GTM Tag template, is not necessary to include this code before your gtag.js or GTM code snippet.

Google Consent Mode should be enabled in settings too. Go to your banner settings > Behaviour tab > Enable Google Consent Mode. You can optionally change a category that allows Ads Storage, Analytics Storage, Functionality Storage, Personalization Storage, and Security Storage in Google Consent mode. 

Without GTM implementation (using gTag.js) you might want to block third-party scripts from firing before consent. This can be done using third-party script blocking.

How CookieScript categories map to Google Consent types

Unlike other Consent Management Platforms, CookieScript allows you to map Google Consent types with categories used in your banner. This can be done in your banner settings > Behavior tab > Google Consent mode section.

Google consent type CookieScript mapped category (can be adjusted in banner settings)
ad_storage (required) Targeting
analytics_storage (required) Performance
functionality_storage (optional) Functionality
personalization_storage (optional) Functionality
security_storage (optional) Functionality


Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.