Configure Google Consent Mode with Didomi

Google Consent Mode v2 is now supported by Didomi. This document includes the changes related to the new version. Learn more in our blog post.

Our team is here to help you comply with all Google requirements before March 2024.

Table of content:

1. What is Consent Mode and what's new in v2?

Applicable Google tags

What's new?

How are the data storage permissions (analytics_storage, ad_storage, ad_user_data, and ad_personalization) granted? 

Difference between Basics and Advanced mode

2. Configure Consent Mode with Didomi - Web

Step 1 - Enable GCM and Set up the default status of your Consent Mode settings

Step 2 - Set up your tags 

3. If you Upgrade GCM V1 to Consent Mode V2

*Custom data layer name

4. Test your implementation

1. What is Consent Mode and what's new in v2?

For advertisers, Google Consent Mode (GCM) serves as a link between data privacy and digital advertising by adjusting the behavior of Google tags to your users' consent status. This allows you to obtain insights on campaign conversions and other data, always respecting user consent choices for both ads cookies and analytics cookies, which will help you optimize and improve ad monetization. 

With Consent Mode, your Google tags will be able to determine whether or not a user has provided cookie consent for advertising and/or analytics purposes:

๐Ÿ‘‰If a user provides consent, your Google measurement tools will continue to run as usual.

๐Ÿ‘‰If a user does not provide consent, the relevant Google tags will adapt accordingly and will not use ads cookies. Instead, other measurement processes will be used at a more aggregate level.

โš ๏ธ Google Consent Mode only works with gtag.js, so make sure you are using gtag.js (and not other legacy tags, such as ga.js, analytics.js or conversion.js),

Applicable Google tags 

Google Consent Mode introduces tag settings that manage cookies for advertising and analytics purposes. This is carried out using the global site tag (gtag.js) or Google Tag Manager, and works with the following products:

  • Google Ads 
  • Floodlight
  • Google Analytics

Learn more about Google Consent Mode in Google's documentation.

What's new?

As a part of Google's ongoing commitment to a privacy-centric digital advertising ecosystem, Google is strengthening the enforcement of the EU user consent policy. Consent mode users need to send two new parameters in addition to ad_storage and analytics_storage:

Consent mode settings Consent Mode Consent Mode V2  What does it mean?
ad_storage โœ… โœ…  Enables storage (such as cookies) related to advertising.
analytics_storage โœ… โœ… Enables storage (such as cookies) related to analytics e.g. visit duration
ad_user_data โŒ โœ… Sets consent for sending user data related to advertising to Google.
ad_personalization โŒ โœ… Sets consent for personalized advertising.

๐Ÿ‘‰ Other optional controls are also available in Consent Mode and supported by Didomi:

  • functionality_storage: allows the storage of functional cookies used by a website or an app (e.g,. language settings)
  • personalization_storage: allows storage related to content personalization (e.g., video recommendations)
  • security_storage: this consent type is always enabled and allows storage related to security, such as authentication functionality, fraud prevention and other user protections.

How are the data storage permissions (analytics_storage, ad_storage, ad_user_data, and ad_personalization) granted? 

The Didomi CMP listens to the consent status updates from Google vendors to update the status of GCM's settings:

  • If Google Advertising (SDK ID: google) receives consent globally (vendor +purposes are enabled): ad_storage, ad_user_data and ad_personalization as well as functionality_storage and personalization_storage are set to granted.
  • If Google Analytics Products (SDK ID: c:googleana-4TXnJigR) receives consent globally (vendor +purposes are enabled) : analytics_storage is set to granted.

Difference between basics and advanced mode

Screenshot 2024-01-30 at 16-45-35-png

Source: Consent Mode Deep Dive for Web & App: Power Durable Performance in 2024

โœ… When consent is granted, the associated tags will function normally.

๐Ÿšซ When consent is denied with the Basic Consent Mode, all tags are blocked and no information is collected. 

๐Ÿšซ &โœ…  When consent is denied with the Advanced Consent Mode, tags won't write cookies but cookieless pings are sent for analytics_storage and ad_storage. 
๐Ÿšซ &โœ… When consent is denied with the Advanced Consent Mode, tag won't send user data for ads purposes

๐Ÿšซ &โœ… When consent is denied with the Advanced Consent Mode, tag will disable personalized advertizing

To know more, consult Google Documentation.

 

Configure Consent Mode V2 with Didomi - Web

In the next paragraph you will learn  how to build your Consent Mode integration with the Didomi CMP in 3 steps.
โš ๏ธ If you are using Consent Mode for Mobile SDK, make sure you follow these steps instead.

Overview:

Screenshot 2024-02-07 at 18.23.40

 

 

Step 1 - Enable GCM and Set up the default status of your Consent Mode settings

๐Ÿ‘‰ This is the status that is propagated to the Google Consent Mode integration on initial page load. You can read the full reference on Google Consent Mode default behavior in the official documentation from Google.

By default, if you do not choose to set a specific status, Didomi will set all the GCM settings to denied on the initial page load. 

To set your own default status, you can choose one of these three options (โš ๏ธ Make sure you do NOT use more than one way to configure the GCM controls):

1) Via Didomi Console 

โ„น๏ธ  The Google Consent Mode integration is enabled upon notice creation. If you create a new notice and do not wish to use Google Consent Mode, you will need to disable it manually.

  1. Go to the Consent notices section and click on the Edit icon for your notice.
  2. Go to step 2. Customization and then to the Integrations section.
  3. Click on the Advertising tab.
  4. Activate the integration (check the box at the top right hand corner).
  5. You can enable the integration and select either Google Analytics products or Google Advertising products, or both vendors

โš ๏ธ To activate Google Consent Mode, you must at least enable one of the two Google products or a warning message will be displayed.

๐Ÿ‘‰ Your old Google Analytics vendor will still be selected and you will need to unselect this  vendor if no longer needed.  To avoid losing data, be sure to configure GA properly before unselecting.

    • For Basic Mode : You can leave the default settings with the box already checked at the top right of the GCM window and the appropriate(s) vendors(s) also checked. Default status are not taken into account, as your Google tags are blocked on the page loads. You can skip this step and go directly to step 2.
    • For Advanced Mode : Check the "set the default status..." item to be able to make a granular choice on each of the sub-options associated. The sub-options checked are the status will be set to granted on initial page load. 
      • E.g., if you enable "Enable ad_storage" before user gives consent" -> On your website the initial page load for ad_storage will be set to granted.
2) Using Didomi's GTM Template: 
Follow these instructions to fully configure Consent Mode with Didomi's GTM template.
  • For Basic Mode: Default status are not taken into account, as your Google tags are blocked on the page loads. You can skip this step and go directly to step 2. 
  • For Advanced Mode: Set Google Consent Mode default status to "granted" for the desired status.
 
3) Via Didomi <script> tags:
<script type="text/javascript">

window.didomiConfig = {

integrations: {

vendors: {

gcm: {

enable: true,

setDefaultStatus: true,

defaultStatus: {

analytics: false, //'analytics_storage' default status Basic mode

ad: false, //'ad_storage' default status

ad_user_data: false, //'ad_user_data' default status

ad_personalization: false, //'ad_personalization' default status

},

}

}

}

};

</script>

Read our Custom Didomi <script> tags section for more information on didomi/javascript configuration

 

Step 2 - Set up your tags 

Basic mode

Google tags (ads and analytics) are blocked until users give their consent. Meaning that the paramenters will be "denied" by default.

To set the Basic mode with Didomi you have 2 options:

  • Block your Google tags as described in this documentation.
    • Note that to use the basic method you have to use didomi-consent event.
  • Using the Didomi <script> tags:
    • use the data-vendor to condition your Google tags. Example for Google Analytics: 
<script type="didomi/javascript" data-vendor="c:googleana-4TXnJigR" src="https://www.googletagmanager.com/gtag/js?id=GA_MEASUREMENT_ID"></script>

You need to do the same for all Google tags.

 

Advanced mode

Google tags (ads and analytics) are loaded before the consent banner is shown, and tags send cookieless pings when consent is declined by the user. Meaning that the paramenters will be "granted" by default.

In Advanced Mode it is important to set the default status you want Didomi to push for your Consent Mode setting.

To set the Advanced Mode with Didomi you have 2 options:

  • With Google Tag Manager, use the didomi-ready instead of didomi-consent to ensure Google tags are loaded after the Didomi SDK is ready, otherwise the default status will not be taken into account.
  • Using the Didomi <script> tags:
    • your tags will load without waiting for the condition on data-vendor:
<script type="didomi/javascript" src="https://www.googletagmanager.com/gtag/js?id=GA_MEASUREMENT_ID"></script>

 

Upgrade Consent Mode V1 to Consent Mode V2

Didomi Console

You do not need to take any specific action in this case: the new Consent Mode attributes (ad_user_data and ad_personalization) are added with a default status = denied. If you want to update this, you can follow these steps.

Didomi GTM template

If you are already using Didomi's GTM template for Consent Mode v1 then you will need to go through the following steps in order to use the latest version of the template:

  1. Log in to your GTM
  2. You will see the following warning. Click on "View".


  3. Select Didomi CMP
  4. Click on "Accept Update":


  5. The new Consent Mode controls will be automatically added and set to denied by default:
  6. If you want to use advanced mode you can change the status of this new controls according to your selected mode.

Didomi script tag

If you are using Didomi's script tag, make sure the default status for the newly added attributes are set as defined in our developer documentation.

 

*Custom data layer name

If you are using the Didomi <script> tags
By default, Didomi uses window.dataLayer as the variable name for your Google Tag Manager data layer. The same data layer name is used for the Google Consent Mode by default.
If you have renamed your data layer name (https://developers.google.com/tag-manager/devguide#renaming), you can instruct Didomi to use another variable name for the Google Consent Mode integration:
<script type="text/javascript">

window.didomiConfig = {

integrations: {

vendors: {

gcm: {

enable: true,
     
dataLayerName: 'customDataLayer' // Custom data layer name, defaults to 'dataLayer'

},

}

}

};

</script>

 

4. Test your implementation

For basic mode, please refer to this article.

For advanced mode, please use this article.