Google Consent Mode Implementation Instructions

Google Consent Mode Implementation Instructions

Nelson
Written by NelsonLast update 7 days ago

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. 
This video will help you to implement Google Consent Mode easily with CookieScript:

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

As of 2023, Google is updating from Google Consent Mode to Google Consent Mode v2. If you want to continue using Google Ads for your advertising in the EEA markets, you need to use a Cookie Banner integrated with Google Consent Mode v2 by March 2024

CookieScript has full integration with Google Consent Mode v2

  • Tag Manager Community Template available

  • Integrated with consent update calls

  • Integrated with consent default calls

  • Supported consent types:

    • ad_storage

    • analytics_storage

    • ad_user_data

    • ad_personalization

    • functionality_storage

    • personalization_storage 

    • security_storage


For more information, read the following documentation from Google:

Google documentation for web:

Google documentation for app:

1. 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. 

Important: Google Consent Mode should be enabled in settings too.

Go to CookieScript user account > Settings > Google Consent Mode, and check the ENABLE GOOGLE CONSENT MODE V2 checkbox: 

You can optionally change a category that allows Ads Storage, Analytics Storage, Functionality Storage, Personalization Storage, and Security Storage in Google Consent mode. 

2. How to implement Google Consent Mode manually, using a GTM (not recommended)?

In order to enable Google Consent Mode with consent modes set by default to denied, 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",
        ad_user_data: "denied",
        ad_personalization: "denied",
        wait_for_update: 500
    });

    gtag("set", "ads_data_redaction", true);
    gtag("set", "developer_id.dMmY1Mm", true);
</script>

The following code snippet shows how to update the consent status to granted, when user agrees to allow advertising cookies:

<script>
    window.dataLayer = window.dataLayer || [];
    
    function gtag() {
        dataLayer.push(arguments);
    }

    gtag("consent", "default", {
        ad_storage: "granted",
        analytics_storage: "granted",
        ad_user_data: "granted",
        ad_personalization: "granted",
        wait_for_update: 500
    });

    gtag("set", "ads_data_redaction", true);
    gtag("set", "developer_id.dMmY1Mm", 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.

Note: If you implement Cookie Script using the GTM template, when ad_storage is granted, ads_data_redaction is a setting that is set in the template and is verified by Google, and can't be changed by a user.

3. How to implement Google Consent Mode without using a GTM?

If you don't use a GTM, you can still implement Google Consent Mode v2. You can do this either manually or by using any of the CookieScript integration plugins.

First, you can simply register at CookieScript, create a new cookie banner, enable Google Consent Mode, and install the banner on your website manually by copying the banner code and inserting it in the header of your website.

Second, CookieScript CMP also has an easy integration with other systems like WordPress, PrestaShop, Shopify, and others, so you can install the CookieScript cookie banner code on the most popular apps following the installation guides.

How do 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 option.

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

ad_personalization (required)

Advertising

ad_user_data (required)

Advertising

Checklist for the correct implementation of Google Ads and Google Consent Mode

  1. Google Consent Mode is enabled in settings.
    See the guide about how to enable Google Consent Mode.

  2. CookieScript is installed in GTM using the latest template from gallery.
    See the guide about how to update the GTM template.

  3. CookieScript trigger is set to Consent Initialization (AND no other tags in that trigger)

  4. GA trigger is set to Initialization
    The right GA trigger should look like this:

    The common mistake is the wrong GA trigger selected like in this example:

  5. Clear browser Cache

  6. Use preview mode to see how it works. Link to debugger info.

Did this answer your question?