Google Consent Mode 2.0 (GDPR Standard - web)

   Permission: Vendor list - GDPR

Google Consent Mode 2.0 ensures that Google vendors on your property comply with an end-user's consent choices for purposes (called consent checks) defined by Google. When a website visitor or app user indicates their consent choices, tags with consent checks adjust their behavior, and user consent choices are preserved across their interaction with the website.

In this article, we will cover how to configure the integration between Sourcepoint and Google Consent Mode 2.0 for a web property who is running a GDPR Standard campaign.  

  Note: Be advised that Google Consent Mode 2.0 only impacts your organizations if you use one or more of the following Google products:

  • Google Ads
  • Google Analytics
  • Search Ads 360
  • Campaign Manager 360
  • Display & Video 360

Consent check overview

Consent check(s) indicates the kind of storage a Google vendor uses.  An end-user can deny or grant the collection of this data. The consent check varies across each Google vendor and can be viewed by selecting a vendor from the GTM platform and expanding the Advanced Settings > Consent Settings tab.

Screen Shot 2022-06-29 at 9.09.12 AM.png

Please refer to the table below for the different consent checks available in Google Consent Mode 2.0:

Consent check Values Description
ad_storage granted | denied Enables storage (such as cookies) related to advertising.
analytics_storage granted | denied Enables storage (such as cookies) related to analytics (e.g. visit duration).
ad_user_data granted | denied Set to granted when end-user has consented to have their data shared with Google. 
ad_personalization granted | denied Set to granted when the user has consented to have their data shared with Google for the purposes of ad personalization.

gtag.js vs Google Tag Manager

Before configuring the implementation, your organization will need to decide whether to implement using gtag.js or Google Tag Manager.

gtag.js Google Tag Manager

Follow the instructions on how to install gtag.js onto your web property for each Google product you use. See the Google documentation below for more information about installing gtag.js for various Google products. 

 gtag.js documentation

  Note: Be aware that if implementing Basic consent mode, in addition to defining the dataLayer you will need to also define a function that controls the firing of Google tags based on the end-user's consent. Leverage the grants object in the getCustomVendorConsents API to implement this function that suits your organization's needs. If implementing Advanced consent mode, you will only need to define the dataLayer.


Implement Google Consent Mode 2.0 on web

Sourcepoint supports two different ways to implement Google Consent Mode 2.0 on your property running a GDPR TCF campaign. Click the tabs below to review which implementation method is suitable for your organization:

gtag.js Google Tag Manager

Implement Google Consent Mode 2.0 using gtag.js on your property running a GDPR TCF campaign by performing the following:

  • Implement default consent states on property
  • Add Google product vendors to vendor list
  • Configure custom purposes for Google Consent Mode 2.0

Implement default consent states on property

  Note: The consent checks and their default consent states implemented in the script is determined by the Google products operating on your property and any specific regionalized opt-in and opt-out jurisdictions you are targeting. You are responsible for making sure that default consent mode is set for each of your measurement products to match your organization's policy.

The default consent states represent the initial value (either denied or granted) for a consent check when a new end-user arrives to your property. These consent states are updated as an end-user makes their consent choices. In this section we will cover how to implement the default consent state for various consent checks using an on-page script.

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

//default behavior
  gtag('consent', 'default', {
    'ad_storage': 'granted',
    'ad_user_data': 'granted',
    'ad_personalization': 'granted',
    'analytics_storage': 'granted',
    'wait_for_update': 500
  });
  
//behavior specific for end-users in the EEA + UK  
  gtag('consent', 'default', {
    'ad_storage': 'denied',
    'ad_user_data': 'denied',
    'ad_personalization': 'denied',
    'analytics_storage': 'denied',
    'region': ['GB', 'BE', 'BG', 'CZ', 'DK', 'CY', 'LV', 'LT', 'LU', 'ES', 'FR', 'HR', 'IT', 'PL', 'PT', 'RO', 'SI', 'HU', 'MT', 'NL', 'AT', 'IS', 'LI', 'NO', 'SK', 'FI', 'SE', 'DE', 'EE', 'IE', 'EL'],
    'wait_for_update': 500
  });
</script> 

Add Google product vendors to vendor list

From the GDPR TCF vendor list associated with your property, add Google vendors that your organization works with (e.g. Google Advertising Products, Google Analytics, etc...).

Screenshot 2024-02-05 at 12.53.38 PM.png


Configure custom purposes for Google Consent Mode 2.0

Your organization will finally need to create custom purposes for your GDPR TCF vendor list that map to the consent checks used by the Google products running on your property.

Click + Add Custom Purpose from the vendor list builder page. Use the provided modal to input a name for the custom purpose. 

Use the Google Consent Mode Category dropdown menu to select a consent type to which this custom purpose will map. Click Create purpose when finished.

Screen_Shot_2022-06-30_at_1.24.25_PM.png

As a best practice, Sourcepoint recommends that you describe the Google products that currently rely on the purpose.

Navigate to the newly created custom purpose and click the custom purpose name.

Screenshot 2024-02-05 at 3.54.36 PM.png

Use the provided description field to note the Google products utilizing the custom purpose as part of the Google Consent Mode integration. Click Apply changes when finished.

Screenshot 2024-02-05 at 3.56.07 PM.png

Set the legal basis for the custom purpose to User Consent

Screenshot 2024-02-05 at 3.57.32 PM.png

Repeat as necessary for other consent types used by Google products on your property. 

Click Save to confirm the updates to your vendor list. Your Sourcepoint and Google Consent Mode 2.0 integration setup is complete. 


Debug default consent mode timing

Your organization can add the following code snippet to Sourcepoint's onConsentReady event callback to check whether the default consent code is set before any other Google product is configured.

If any other Google product is configured before Google Consent Mode code is set then you will receive the following alert in your browser console: GCM not being configured soon enough.

onConsentReady: function (consentUUID, euconsent) {
    console.log('[event] onConsentReady', arguments); 
    //Loop through all the dataLayer objects
      for(var obj in dataLayer){
        //initialize vars
        gcm_conset_pos = -1;
        gcm_config_pos = -1;
                        
        //mark when GCM is first set
        if(dataLayer[obj][0]==='consent'){                   
          console.log('GCM configured at position ' + obj + ' in the data layer');
          if(dataLayer[obj][1]==='default'||dataLayer[obj][1]==='update'){
            var gcm_conset_pos = obj;    
          }
        }
                        
        //mark when the first Google product is configured
        if(dataLayer[obj][0]==='config'){
          console.log(dataLayer[obj][1] + ' configured')
          var gcm_config_pos = obj;
          console.log("breaking: ", (gcm_conset_pos - gcm_config_pos));
          break;
        }
      }
                    
      //check if GCM is happening before any config is happening
      if((gcm_conset_pos - gcm_config_pos)0){
        console.log("GCM not being configured soon enough")
      }
      else{
        console.log("GCM timing is okay")
      }
}

Test integration

Regardless of how your organization has implemented Google Consent Mode 2.0 (either via Google Tag Manager or gtag.js), you can test the setting of Google's consent checks via Google Tag Assistant. 

 Google Tag Assistant

Click Add Domain.

Screenshot 2024-02-12 at 2.30.05 PM.png

Use the provided modal to input your property's URL that is currently integrated with Sourcepoint's CMP and Google Consent Mode 2.0.

Screenshot 2024-02-12 at 2.33.20 PM.png

From an event, navigate to the output for your container/tag and select the Consent tab. From the subsequent table, you can discern the status of the Google consent checks and compare them to consented/rejected purposes in your privacy manager.

Screenshot_2024-02-12_at_2_47_54 PM.jpg

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Article is closed for comments.