Google Consent Mode v2 (Advanced)

circle-check

Google Consent Mode v2 ensures that Google vendors associated with a consent notice comply with an end-user's consent choices (called consent types) defined by Google. In this article, we will cover how to implement Google Consent Mode v2 on a consent notice utilizing Google advanced consent mode setup.

circle-info

Click here for information on how to configure Google basic consent mode.


In the advanced version of Google Consent Mode v2, Google product tags still load when an end-user accesses your website or app (unlike the basic version). Google tags will load the consent mode API and do the following:

  • Set default consent states for consent types. By default, consent may be denied, unless your organization sets its own default values. While consent is denied, the Google tags send cookieless pingsarrow-up-right.

  • Wait for end-user interaction with the consent notice and update consent states accordingly. Only when an end-user grants consent to data collection, will Google tags send the full measurement data. Learn more about tag behaviorarrow-up-right.

The following Google products have built-in consent checks and will adjust behavior based on the end-user's consent state for the Google consent types:

  • Google Tag

  • Google Analytics (includes Google Analytics for Firebase SDK)

  • Google Ads (includes Google Ads Conversion Tracking and Remarketing; support for Phone Call Conversions is pending.)

  • Floodlight

  • Conversion Linker

circle-info

Google Consent Mode only supports gtag.js . Ensure your organization is not utilizing legacy tags for your Google products such as ga.js, analytics.js, or conversion.js .

Consent check varies across each Google product and can be viewed by selecting a vendor from the GTM platform and expanding the Advanced Settings > Consent Settings tab.

Didomi offers multiple ways your organization can implement Google Consent Mode v2 (Advanced) for GDPR consent notices. Please see the tabs below for the method that best suits your organization's needs:

In this tab, we will cover how to utilize Google Tag Manager to implement Google Consent Mode v2 (Advanced) for a GDPR consent notice.

From the consent notice, click the Customization tab and select Integrations.

Click Consent Modes and enable the toggle inline with Google Consent Mode v2.

Expand the Google Consent Mode v2 accordion to configure the details of the integration. Review the table below for information on each toggle in the integration configuration:

circle-exclamation
Toggle
Description

Set the default status of Google Consent Mode when the page loads

The advanced version of Google Consent Mode v2 will load Google tags when an end-user accesses your website with a default status for all Google consent types. The default status is denied unless configured otherwise below. Enable this toggle to ensure this default status is set for the advanced version.

Enable Google Advertising Products

Will add Google Advertising Products vendor (API ID: google) to the consent notice. Designed to encompass Google products who utilize one or more of the following consent types:

  • ad_storage

  • ad_user_data

  • ad_personalization

  • functionality_storage

  • personalization_storage

  • security_storage

Enable {consent type} before user gives consent

For each consent type, will override the default status of the Google consent type and set it to granted as soon as the Google product tag loads. Note: Consult with your organization's legal counsel and DPO before enabling any of these settings.

Enable Google Analytics Products

Will add Google Analytics Products vendor (API ID: googleana-4TXnJigR) to the consent notice. Designed to encompass Google products who require the analytics_storage consent type.

Enable TCF integration with Google Consent Mode

Enables Didomi to set an additional flag (TCData.enableAdvertiserConsentMode to true) for getTCData and addEventListener commands. This additional flag allows Google to infer and map consent settings to the following Google Consent Mode v2 consent types based on IAB TCF purposes:

  • ad_storage

  • ad_user_data

  • ad_personalization

Click herearrow-up-right for more information on how Google calculates the mapping between IAB TCF purposes and Google consent types. Note: The TCF integration with Google Consent Mode does not support Google product tags that require the analytics_storage, functionality_storage, personalization_storage, or security_storage consent types. For Google products that require the analytics_storage consent type, Didomi will set this consent type to granted if the end-user consents globally (consent to vendor and all of its purposes) for Google Analytics Products (API ID: googleana-4TXnJigR).

Data layer name

By default, Didomi utilizes dataLayer as the variable name for your organization's Google Tag Manager dataLayer. If your organization has edited the variable name for your dataLayer then input that variable name in the provided space.

Publish and embed the Didomi web SDK onto your website when finished.

circle-info

Alternatively, your organization can utilize the window.didomiConfig object to configure Google Consent Mode v2 (Advanced) on your consent notice. While Didomi recommends utilizing the console to enable the feature as detailed above, the window.didomiConfig method can be a useful method for testing.

Configure Google product tag(s)

circle-exclamation

In order to ensure Google product tags are loaded (and the default status for Google consent types exposed) your organization must configure Google product tags to load once the Didomi SDK is ready and Google Consent Mode v2 is set.

There are two methods available to your organization to configure the Google product tags. Choose a method below that best suites your organization's use-case:

  • Google Tag Manager tag on-page

  • Google product tags in Google Tag Manager

Google Tag Manager tag on-page

Utilize the Didomi <script> tag attributes arrow-up-rightto edit the Google Tag Manager tags on your website to include type="didomi/javascript . The Google product tags configured in your Google Tag Manager will load as soon as the SDK is ready but without a specific link to a vendor.

Google product tags in Google Tag Manager

From your organization's Google Tag Manager workspace, navigate to your Google product tag and edit the trigger.

Use the Google Tag Manager workflow to configure a new trigger for the Google product tag. The trigger will vary slightly depending on whether your Didomi consent notice targets multiple regulations (GDPR, CPRA, NJDPA, etc...) since Google Consent Mode v2 is only available for GDPR.

GDPR-only consent notice

For a consent notice that only targets GDPR, configure your trigger with the following fields:

Field
Value

Trigger Type

Custom Event

Event name

didomi-ready

This trigger fires on

All Custom Events

When finished, Save the trigger and tag setup. Submit your Google Tag Manager container changes aligned with your organization's policies.

Multiple regulation consent notice

For a consent notice that targets multiple regulations (e.g. GDPR and CPRA) your organization will need to duplicate the Google product tags and create a trigger for each of the tags (one triggered for GDPR and the other for the non-GDPR regulation(s).

Before continuing, be sure to create data layer variables for the following as they will be used in the triggering:

  • didomiRegulationName

  • didomiVendorsEnabled

The Google product tag that targets GDPR should have a trigger with the following fields:

Field
Value

Trigger Type

Custom Event

Event name

didomi-ready

This trigger fires on

Some Custom Events

Event condition

didomiRegulationName equals gdpr

The Google product tag that targets the non-GDPR regulation should have a trigger with the following fields:

Field
Value

Trigger Type

Custom Event

Event name

didomi-consent

This trigger fires on

Some Custom Events

Event condition 1

didomiRegulationName does not equal gdpr

Event condition 2

didomiVendorsEnabled contains <Didomi API ID of the Google product>

circle-info

Alternatively, your organization could create separate containers one targeting GDPR regulations and the other targeting the non-GDPR regulation(s) and load each container based on the applicable regulation.

When finished, Save the trigger and tag setup. Submit your Google Tag Manager container changes aligned with your organization's policies.

When successfully and appropriately configured, a Google Consent Mode v2 (Advanced) implementation will trigger Google product tags but with the consent state of Google consent types default to denied unless otherwise configured. In this section we will cover how to test whether your Google Consent Mode v2 (Advanced) configuration is working as intended.

circle-info

If you need further assistance or have noticed something unusual, please feel free to reach out to [email protected]envelope.

As mentioned above during the configuration, Google Consent Mode v2 (Basic) requires the use of the following vendors Google Advertising Products (API ID: google) and/or Google Analytics Products (API ID: googleana-4TXnJigR) depending on the Google products your organization utilizes.

Before continuing, ensure that the correct vendors are added to the consent notice to reflect the Google products that will be triggered:

Test Google product tag(s) triggering

When testing the Google Consent Mode v2 (Advanced) implementation, your organization will want to confirm three actions :

  • Google product tags load with consent types defaulted to a consent state of denied unless configured otherwise

  • Google product tags update to show consent types set to a consent state of denied due to end-user choice

  • Google product tags update to show consent types set to a consent state of granted due to end-user choice

How your organization tests that Google product tag(s) are triggering as expected of a Google Consent Mode v2 (Advanced) setup is dependent on how you configured the implementation on the consent notice:

Implementation method
Available testing

Google Tag Manager

  • Google Tag Manager

  • Website

gtag.js

  • Website

GTM template

  • Google Tag Manager

  • Website

In this tab, we will cover how to test your organization's Google Consent Mode v2 (Advanced) implementation via the website on which the Didomi consent notice is deployed.

circle-info

It is recommended that the following tests are done using an Incognito window for your browser.

gcd parameter

The gcd parameter is included in the payload for every Google Ad Words and Google Analytics network request when Google Consent Mode v2 is enabled. The parameter reflects the status of Google Consent Mode v2 consent types and assures Google that consent mode is enabled and that consent is collected.

circle-exclamation

The gcd parameter is a character string that is composed of several components that can multiple values. The format of the character string is as follows:

gcd=13<ad_storage>3<analytics_storage>3<ad_user_data>3<ad_personalization>5

Component
Description

Prefix

Unchanging start of the character string. Represented by an 11 or 13

Suffix

Unchanging end of the character string. Represented by a 5 or 7

Separator

Separates the consent status values for the different consent types (ad_storage, analytics_storage, etc...). Represented by a 1 or 3

Consent status

The consent status for each of the represented consent types (ad_storage, analytics_storage, ad_user_data, ad_personalization) follows the structure below:

  • p - Denied default value

  • t - Granted default value

  • q, m, u - Denied after end-user choice

  • e, r, n, v - Granted after end-user choice

  • 1 - Undefined

circle-check

Google product tags load with consent types defaulted to denied

Access the website on which you have deployed the Didomi consent notice with a Google Consent mode v2 (Advanced) implementation and let the consent notice load on the page. It is important that you do not interact with the consent notice yet.

Open the browser console and select the Network tab. Use the provided search filter to check requests that contain the following for the gcd parameter:

  • analytics.js

  • gtag

  • collect

Ensure the consent status values for each consent type within the gcd parameter matches the expected default settings.

Google product tags update to show consent types set to denied due to end-user choice

Access the website on which you have deployed the Didomi consent notice with a Google Consent mode v2 (Advanced) implementation and let the consent notice load on the page. Deny consent for all vendors and purposes.

Open the browser console and select the Network tab. Check the requests for your Google products to ensure the consent status value for each consent type within the gcd parameter is set to denied due to end-user choice.

Google product tags update to show consent types set to granted due to end-user choice

Access the website on which you have deployed the Didomi consent notice with a Google Consent mode v2 (Advanced) implementation and let the consent notice load on the page. Grant consent for all vendors and purposes.

Open the browser console and select the Network tab. Check the requests for your Google products to ensure the consent status value for each consent type within the gcd parameter is set to granted due to end-user choice.

Last updated