PubConsent
Web Standard Integration

GTM Integration (Consent Mode)

13min

Google Tag Manager offers various functionalities that interact with each other to help you manage tag behavior in response to settings consents.

This documentation is intended to provide a detailed overview of each setting in Google’s Consent Mode, strictly following the explanations and guidelines as provided by Google. It does not imply that the Consent Mode settings are designed to satisfy or address any particular regulatory requirements.

The complete explanation of how Google's consent mode works is available at the following link: https://support.google.com/google-ads/answer/10000067

The following guide provides the steps to integrate and use the Pubconsent template for Google Tag Manager. This template has been created to integrate PubConsent with GTM, which means that the PubConsent script still needs to be integrated into the pages.

This integration is valid for both CMP type we offer.

Before following this guide, make sure that the PubConsent integration code available in the configurator is present on the page.

Make sure you read the documentation provided by the Google at the following link by checking the Tag Manger sections: https://developers.google.com/tag-platform/security/guides/consent?consentmode=advanced

Template Import

Log in to Google Tag Manager and open the 'Workspace' tab.

Click on 'Search Gallery' in the Templates section of Google Tag Manager.

Document image


Now search for "Pubtech CMP" and then click the "Add to workspace" button.

Document image


Template usage

Log in to Google Tag Manager and open the 'Workspace' tab.

Create a tag by clicking the 'New' button:

  1. Document image
    
    Document image
    

Open the Tag Configuration and select the Pubtech CMP template imported previously:

Document image

Document image


Here you can configure our Pubtech CMP template:

Document image


Before proceeding to configure the default values from the Google Tag Manager integration for consents, we can configure the Ads Data Redaction and urlPassThrough parameters. By activating the option Ads Data Redaction When ad_storage is denied, ad click identifiers sent in network requests by Google Ads and Floodlight tags will be redacted. Network requests will also be sent through a cookieless domain. The option urlPassThrough Improve the quality of ad click measurement when ad_storage is denied by sending data directly in the URLs.

By clicking on 'Add Row', you can specify the default parameters (detailed explanation below):

Document image


Here you can configure the region (leave it empty by default), the types of consent granted, and the types of consent denied. These are the default configurations when GTM starts its execution on the page. Based on your preferences, you can write the types of consent granted or denied. Here is the complete list of consent types:

  1. ad_storage
  2. ad_user_data
  3. ad_personalization
  4. analytics_storage
  5. functionality_storage
  6. personalization_storage
  7. security_storage

Add the configurations and click on the "Add" button.

Configuration used in the example:

  • Region:
  • Granted Consent Types: ad_storage,analytics_storage,personalization_storage,security_storage
  • Denied Consent Types: functionality_storage If you want to specify different behaviors for different regions, you also need to add the default configuration with an empty Region.
Document image


Now you need to choose the Trigger for this Tag.

Document image


Here, choose the trigger "Consent Initialization - All Pages".

Document image


Change the name at the top left and click the "Save" button.

At this point, you have configured the tag correctly.

Document image


After completing the entire procedure, you can proceed with the normal testing using GTM preview.

To get an overview of consent, we recommend enabling consent overview within Tag Manager: Within Tag Manager, go to "Admin" -> "Container" -> "Container Settings" -> "Enable consent overview."

Consents' Mapping (Google Consent Mode)

To know which user choices correspond to Google's consent types, here's the corresponding mapping we provide:

CMP Type: GDPR TCF
CMP Type: Google Consent Mode
  • ad_storage -> TCF Purpose 1
  • ad_user_data -> TCF Purpose 1 e 7
  • ad_personalization -> TCF Purpose 3 e 4
  • analytics_storage -> Cookie Measurement
  • functionality_storage -> Cookie Feature
  • personalization_storage -> Cookie User Experience
  • security_storage -> Cookie Feature



Consent trigger

If you need a trigger that is executed when there's consent, our integration sends an event to GTM called __pubtech_queue_on_consent

Thanks to this event, it's possible to create a trigger in GTM to be used according to the execution needs of your GTM tags.

The event we show below is triggered:

  • Upon the user's consent release
  • Upon the user's consent change
  • At the beginning of the page if consent has already been previously given

The management or removal of any triggered tags throughout the page is the responsibility of those who implement the tags.

The trigger to create in the trigger section of GTM is a Custom Event, adding the event name: __pubtech_queue_on_consent

Document image


Once the trigger is saved, you can use it as a trigger for your tags. Now you can use this trigger directly or in combination with other triggers according to your needs. We want to inform you that this Custom Event has been added because through Google Tag Manager Triggers we noticed that it's not possible to execute tags when the user clicks to give consent (whether it's a refusal or an accept all) because it can happen at an unknown time. However, once consent is obtained, the CMP will update the consent status in GTM as quickly as possible.

Here is the link to the Google documentation for implementations and configurations:https://support.google.com/analytics/answer/9976101