Google Consent Mode

Google allows using its own consent mode in order to comply with the privacy regulations without disabling services provided by Google, such as Google Analytics or Google Ads. More information about Google Consent Mode is available in the official Google Consent mode documentation

Google’s 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

How to implement Google Consent Mode with Cookie-Script

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>

It is important to 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.

Google Consent Mode is an optional feature and 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 and Analytics Storage in Google Consent mode.