For the complete documentation index, see llms.txt. This page is also available as Markdown.

Google Consent Mode v2 (Basic) - GDPR

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 basic consent mode setup.

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


In the basic version of Google Consent Mode v2, Google product tags should be blocked by your organization from loading until an end-user interacts with your consent notice on the website. Once the end-user interacts with the consent notice, one of the following can occur:

Consent

If an end-user grants consent then Google product tags will load and execute the consent mode APIs.

No Consent

If an end-user does not grant consent then no data is transmitted to Google (not even a default consent state). Google tags will remain blocked and Google Consent mode's modeling for ads will be based on a general model.

The following Google products have built-in consent checks and will adjust behavior based on the end-user's consent state for 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

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 (Basic) 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 (Basic) 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:

Toggle
Description

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

The basic version of Google Consent Mode v2 will block Google product tags an end-user interacts with your consent notice. Ensure this toggle is de-activated to ensure no default status is set for the basic 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. With Google Consent Mode v2 (Basic), Google product tags will be blocked until the end-user grants consent and not even the consent state is sent to Google. These settings do not need to be enabled.

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

Alternatively, your organization can utilize the window.didomiConfig object to configure Google Consent Mode v2 (Basic) 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)

In order to ensure Google product tags are blocked in accordance with a Google Consent Mode v2 (Basic) setup your organization must configure the Google product tags in Google Tag Manager to trigger only when an end-user grants consent to the respective Google product.

First, your organization should create a data layer variable for didomiVendorsEnabled as it will be used in the triggering:

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

Configure your trigger with the following fields:

Field
Value

Trigger Type

Custom Event

Event name

didomi-consent

This trigger fires on

Some Custom Events

Event condition

didomiVendorsEnabled contains <vendor API ID> Note: Replace <vendor API ID> with the actual ID for the vendor that when consented to will trigger the Google product tag.

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

In this tab, we will cover how to implement Google Consent Mode v2 (Basic) for a GDPR consent notice if your organization is utilizing gtag.js tags for the Google products directly on your website.

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:

Toggle
Description

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

The basic version of Google Consent Mode v2 will block Google product tags an end-user interacts with your consent notice. Ensure this toggle is de-activated to ensure no default status is set for the basic 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. With Google Consent Mode v2 (Basic), Google product tags will be blocked until the end-user grants consent and not even the consent state is sent to Google. These settings do not need to be enabled.

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

Alternatively, your organization can utilize the window.didomiConfig object to configure Google Consent Mode v2 (Basic) 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.

Install Google product tags

In order to ensure Google product tags are blocked in accordance with a Google Consent Mode v2 (Basic) setup your organization must configure each Google product tag on your page to trigger only when an end-user grants consent to the respective Google product.

Utilize the Didomi <script> tag attributes to edit the gtag.js tags for each Google product tag on your website to include type="didomi/javascript" data-vendor="{Google Vendor API ID}" .

Information on implementing Google Consent Mode v2 (Basic) via the Didomi GTM template can be found below:

Didomi GTM template

Didomi has updated its support since the release of Google Custom Mode v2 with simplified native integrations with Firebase and Advanced App Partners (AAP) like Airbridge, ApplyFlyer, etc...

Organizations who have implemented the previous Google Consent Mode v2 solution via the setConsent method should update their implementations via the instructions below and remove setConsent for Google Consent Mode v2 from the application code.

On mobile applications, Google Consent Mode v2 works through SDKs such as Firebase and Google Ads SDKs. These SDKs rely on consent signals that are provided programmatically at runtime. Consent signals must be passed early in the app lifecycle to ensure Google SDKs respect user choices.

In this tab, we will cover how to implement Google Consent Mode v2 (Basic) for a GDPR consent notice for a mobile application.

Requirements

Review the table below for more information on the required minimum version of the Didomi mobile SDK used in your application that supports the Firebase SDK and Google Ads SDK:

Mobile SDK
Minimum version

iOS/tvOS

> v2.27.0

Android

> v2.27.0

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:

Toggle
Description

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

The basic version of Google Consent Mode v2 will block Google product tags an end-user interacts with your consent notice. Ensure this toggle is de-activated to ensure no default status is set for the basic 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. With Google Consent Mode v2 (Basic), Google product tags will be blocked until the end-user grants consent and not even the consent state is sent to Google. These settings do not need to be enabled.

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 here 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).

Firebase

Firebase is the core SDK for Google apps. Once enabled, the integration ensures:

  • proper mapping of Didomi consent signals to Firebase

  • automatic propagation to Google SDKs for measurement and advertising

  • simplified compliance for GDPR and similar regulations

Branch

App Attribution Partners (AAP) like Branch need to receive accurate consent signals to comply with privacy regulations and forwards these signals to Google.

When Branch is enabled in the console and the Branch SDK is present in your app, Didomi manages the Google Consent Mode signal propagation for Branch.

For end-users in GDPR-regulated regions, Didomi indicates compliance context by setting eea to 1 and applies default values for consent signals based on your configuration in the console. After the end-user provides consent, Didomi recalculates the status of these signals using the end-user’s consent for Google Advertising Products and Google Analytics Products and updates Branch accordingly.

For users outside GDPR regions, Didomi sets eea to 0 to indicate that no GDPR obligations apply.

Kochava

App Attribution Partners (AAP) like Kochava need to receive accurate consent signals to comply with privacy regulations and forwards these signals to Google.

When Kochava is enabled in the console, Didomi ensures that Kochava receives the consent string needed to populate Google’s consent signals. Kochava uses this consent information during install and event transmissions.

When the CMP collects end-user consent, the consent string is shared with Kochava through Didomi, provided that the SDK is configured to send installs or events after the user has given consent.

Kochava parses the TCF consent string and applies it to build Google-required signals. This process works seamlessly with CMPs that support the IAB Transparency & Consent Framework (TCF) v2.3 or the Global Privacy Platform API v1.1.

Airbridge

App Attribution Partners (AAP) like Airbridge need to receive accurate consent signals to comply with privacy regulations and forwards these signals to Google.

When Airbridge is enabled in the console and the Airbridge SDK is detected in the app, Didomi computes the appropriate Google Consent Mode signals and shares them with Airbridge.

For end-users located in the EEA (European Economic Area) and therefore subject to GDPR, Didomi informs Airbridge that the user is in a regulated region by setting eeaRegion to true. At the same time, Airbridge receives the default values for consent signals based on your configuration in the Didomi SDK. Once the end-user provides their consent through the CMP, Didomi updates these signals and ensures that Airbridge reflects the end-user’s actual preferences.

For end-users outside the EEA, Didomi signals that the end-user is not in a GDPR-regulated region by setting eeaRegion to false.

AppsFlyer

App Attribution Partners (AAP) like AppsFlyer need to receive accurate consent signals to comply with privacy regulations and forwards these signals to Google.

When AppsFlyer is enabled in the console and the AppsFlyer SDK is present in your app, Didomi manages the Google Consent Mode signal propagation for AppsFlyer.

  • For users in GDPR-regulated regions, Didomi indicates compliance context by setting isUserSubjectToGDPR to true and applies default values for consent signals based on your configuration in the console. After the end-user provides consent, Didomi recalculates the status of these signals using the end-user’s consent for Google Advertising Products and Google Analytics Products and updates AppsFlyer accordingly.

  • For users outside of GDPR jurisdiction, Didomi will set isUserSubjectToGDPR to false .

  • If you have enabled IAB TCF integration with Google Consent Mode, Didomi will automatically instruct AppsFlyer to use the TC string by setting enableTCFDataCollection(true) . As a result, AppsFlyer can directly get the user's consent from the TC string in SharedPreferences

When successfully and appropriately configured, a Google Consent Mode v2 (Basic) implementation will keep the relevant Google product tags from triggering until the end-user grants consent to the respective Google vendors associated with your consent notice. In this section we will cover how to test whether your Google Consent Mode v2 (Basic) configuration is working as intended.

If you need further assistance or have noticed something unusual, please feel free to reach out to google-support@didomi.io.

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 triggering

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

  • Google products do not fire prior to consent action

  • Google products do not fire if an end-user denies consent

  • Google products fire only when an end-user grants consent

How your organization tests that Google product tag(s) are triggering as expected of a Google Consent Mode v2 (Basic) 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

Mobile SDK

  • Didomi SDK Logs

  • Firebase DebugView

  • ADB (Android) or Xcode Console (iOS) for runtime logs

  • Network sniffers (e.g. Charles Proxy) for verifying event payloads

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

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

Google product tags do not fire prior to consent action

Access the website on which you have deployed the Didomi consent notice with a Google Consent mode v2 (Basic) 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 navigate to cookie storage (for Chrome it is the Application> Cookies and Firefox it is Storage>Cookies).

Ensure that no cookies are dropped from consent-aware Google products utilized by your organization (e.g. Google Analytics, Ad Words, Floodlight, etc...).

Click here for more information on cookie names for Google products.

Next, select the Network tab in the browser console and use the provided search filter to search for:

  • analytics.js

  • gtag

  • collect

  • gcs

  • gcd

Ensure there are no network requests being performed with these parameters.

Google product tags do not fire if an end-user denies consent

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

Open the browser console and navigate to cookie storage (for Chrome it is the Application> Cookies and Firefox it is Storage>Cookies).

Ensure that no cookies are dropped from consent-aware Google products utilized by your organization (e.g. Google Analytics, Ad Words, Floodlight, etc...).

Click here for more information on cookie names for Google products.

Next, select the Network tab in the browser console and use the provided search filter to search for:

  • analytics.js

  • gtag

  • collect

  • gcs

  • gcd

Ensure there are no network requests being performed with these parameters.

Google product tags fire only when an end-user grants consent

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

Select the Network tab in the browser console and verify that requests for Google Analytics and/or Google Ad Words contain a gcd parameter and that its value reflects the choices made by the end-user.

The value for gcd will resemble a string of characters: gcd=11<ad_storage>1<analytics_storage>1<ad_user_data>1<ad_personalization>5 Each storage has the possible value “e”, “r”, “n” or “v” which equal granted in a GCM update after user interaction with the CMP

In this tab, we will cover how to test your organization's Google Consent Mode v2 (Basic) implementation via Google Tag Manager.

It is recommended that the following tests are done using an Incognito window for your browser or that you clear your cookies and local storage for your website in your favorite browser.

Navigate to the container where you configured and published your Google Consent Mode v2 (Basic) in your Google Tag Manager account and click Preview.

Use the provided field to input the URL of your website on which the Didomi consent notice is implemented. Click Connect when finished.

Google product tags do not fire prior to consent action

Let the consent notice load in the subsequent window of the tag assistant. It is important that you do not interact with the consent notice yet.

Navigate to events on the left-hand side of the tag assistant and select the Tags tab. Ensure that none of your Google product tags are fired.

Next, click the Consent tab for events on the left-hand side and ensure that Consent state has not been set yet.

Google product tags do not fire if an end-user denies consent

Let the consent notice load in the subsequent window of the tag assistant. Deny consent for all vendors and purposes.

Navigate to events related to the "deny consent" action on the left-hand side of the tag assistant and select the Tags tab. Ensure that none of your Google product tags are fired.

Next, click the Consent tab for events related to the "deny consent" action on the left-hand side and ensure that all Google consent types are set to Denied (except for security_storage).

Google product tags fire only when an end-user grants consent

Let the consent notice load in the subsequent window of the tag assistant. Grant consent for all vendors and purposes.

Navigate to didomi-consent event related to the "grant consent" action on the left-hand side of the tag assistant and select the Tags tab. Ensure that your Google product tags have fired.

Next, click the Consent tab for events related to the "grant consent" action on the left-hand side and ensure that the appropriate Google consent types have On-page Update and Current State set to Granted.

How your organization tests depends on the integrations configure and tools available for your mobile application. In this tab, we will cover how validations that your organization should perform in order to check default and updated signals are set and sent correctly.

Enable debug logs

Activate verbose logging in Didomi SDK via:

Android

iOS

If integrated with Firebase, enable Firebase DebugView via:

Android

iOS

Launch with -FIRDebugEnabled argument

Testing criteria

Analyze the logs and network payloads for each criterion to ensure the expected results are set.

Test best practices

  • Test your application across multiple regions and regulations

  • Verify behavior on first app launch and after end-user consent actions

  • Always use real SDK builds and not mocks for final validation

Last updated