GTM Integration (Consent Mode)
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
Log in to Google Tag Manager and open the 'Workspace' tab.
Click on 'Search Gallery' in the Templates section of Google Tag Manager.
Now search for "Pubtech CMP" and then click the "Add to workspace" button.
Log in to Google Tag Manager and open the 'Workspace' tab.
Create a tag by clicking the 'New' button:
-
Open the Tag Configuration and select the Pubtech CMP template imported previously:
Here you can configure our Pubtech CMP template:
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):
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:
- ad_storage
- ad_user_data
- ad_personalization
- analytics_storage
- functionality_storage
- personalization_storage
- 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.
Now you need to choose the Trigger for this Tag.
Here, choose the trigger "Consent Initialization - All Pages".
Change the name at the top left and click the "Save" button.
At this point, you have configured the tag correctly.
After completing the entire procedure, you can proceed with the normal testing using GTM preview.
Google documentation links: https://support.google.com/analytics/answer/9976101
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."
To know which user choices correspond to Google's consent types, here's the corresponding mapping we provide:
- 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
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
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