Google Consent Mode integration
Consent Mode V2 is an integration that allows you to maximize control and transparency over the management of user consent in your web space: until the user has given consent, their data will not be saved. By following the steps and guidelines provided here, you can ensure proper consent management and improve user experience on your platform, while simultaneously complying with privacy regulations and protecting the rights of individuals.
Difference between GCM Basic and Advanced
The difference between these two modes of Google Consent Mode is found in the management of tag blocking: Basic mode simply blocks tags when consent is denied. In Advanced mode, if consent is denied, Google tags are still activated and the data is sent but anonymously (unless ads_data_redaction is set to TRUE).
It is advisable to consult a lawyer before proceeding with this latter method.
The advanced mode can be enabled for the creation of a tag by choosing the "Not Set" option in the consent settings. In this guide we will continue with the basic mode.
GTM preparation steps
This guide requires the use of Google Tag Manager, both for native integration via template and for manual integration.
GTM preparation steps
This guide requires the use of Google Tag Manager, both for native integration via template and for manual integration.
Google Tag Manager
From the Google Tag Manager dashboard click on Administration and then Container Settings:
From here uncheck the Activate consent overview checkbox:
Avacy
On the Avacy platform, go to the dashboard of the reference web space on which you want to enable Google Consent Mode support, enter the Cookie Banner section and, in the Advanced Settings, under the Support for Google Consent Mode select "Force Activation". In this way, it is possible to view a new section containing the purposes for managing Google's consent indicators.
The purposes on the Avacy cookie banner are associated with consent indicators as follows:
| GTM consensus indicator | Purpose of cookie banner | |----------------------------|---------------------------- -------------------------------------------------- -------------------------------------------------- --| | ad_storage | Management of cookies or advertising device identifiers | | ad_personalization | Sharing data with Google for its own advertising purposes | | ad_user_data | Receive personalized advertising | | analytics_storage | Activation of Google Analytics functionality | | functionality_storage | Saving technical settings | | personalization_storage | Content customization | | security_storage | Tracking for security purposes |
Avacy template integration
The Avacy template automates some steps of the manual integration mode such as injecting the script that initializes the default consent indicators and the integration of the cookie banner into the page.
Download link
You can download the Avacy template at following download link.
The template can be imported manually from the Google Tag Manager workspace from the "Templates" section.
From "Tag Templates", click the "New" button. The template editor will open, from here you can import the Avacy template by clicking on the three dots icon next to the "Save" button, click on "Import" and select the .tpl file.
To install the template in the container, simply return to the tag manager work area, in the "Tags" section and add a new tag using the appropriate button.
then click on "Tag configuration" and select the Avacy CMP template from the list of custom tags.
Consequently, you will have to enter the mandatory fields Webspace Key and Team Name, which can be found on Avacy by going to the web space dashboard, clicking on Webspace settings in question and then on Integration of Avacy on your web space. In the Google Tag Manager section, both necessary information will be visible.
Enter this data in the mandatory fields of the template and in the space dedicated to the activator select "Consent Initialization - All Pages".
Advanced Settings (optional)
In the advanced settings there are the following fields:
| Features | Description | |----------------------------|---------------------------- -------------------------------------------------- -------------------------------------------------- --| | Choose specific version | It is possible to force a specific version of the Avacy cookie banner. It is always recommended to use the latest version and leave the field blank. | | Override banner configuration | You can insert a JSON by placing values to override in the configuration object. |
Activator and consent settings
Once this is done, return to the container and, in the tag list, click on the shield icon at the top right.
An overview of the tags whose consent has not yet been configured via Google Consent Mode and those which have been configured correctly will be visible.
Below is a table of the consensus indicators supported by Google.
| GTM consensus indicator | Description | |----------------------------|---------------------------- -------------------------------------------------- -------------------------------------------------- --| | ad_personalization | Enable the use of personal data for advertising purposes such as remarketing or interest-based targeting. | | ad_storage | Enable browser storage (such as cookies) related to advertising. | | ad_user_data | Allows the collection of personal data for advertising purposes. | | analytics_storage | Enable browser storage (such as cookies) related to analytics, such as length of visit. | | functionality_storage | Enable browser storage that supports website or app functionality, such as language settings. | | personalization_storage | Enable browser storage related to personalization, such as video recommendations. | | security_storage | Enable browser storage related to security, such as authentication functionality and fraud prevention. |
Some tags are configured with integrated consent indicators (generally Google tags e.g. Google Analytics) and independently modify the tracking services and related methods based on these indicators. The other tags, however, do not have integrated consent indicators. To integrate the Consent Mode you must set the additional consent indicators.
Let's take the integration of a Facebook Pixel as an example.
Once you have added the tag inside the container, click on the pencil icon and scroll to Advanced Settings. Then click on Consent settings and select the option "Additional consent is required to activate the tag".
As pictured, manually set one or more of the Google-supported consensus indicators described in the table above.
In the "Triggers" section, create a new trigger of type "Custom Event" and set the event name to avacy_consent_update
.
Then connect this activator to the Facebook Pixel in the "Activation" section of the tag.
Testing
At this point, following the example of the previous Facebook Pixel, the tag should be activated only if consent is given to the purpose relating to the ad_storage
indicator, in other words, if that specific functionality is accepted from the cookie banner of the web platform.
check the purpose relating to the ad_storage indicator to launch the tags on which we have set that consensus indicator
We can verify from the preview of the container that, by checking the "Manage cookies or advertising device identifiers" purpose in the cookie banner, the avacy_consent_update event is actually launched via the dataLayer API. At this point the tags that trigger this event will independently understand whether they should be launched or not based on the consensus indicators we have specified for them.
In this case, having set the ad_storage indicator for the Facebook Pixel, we can check from the debugger how, when the event is launched, the tag is actually activated.
Similarly, in the Consent tab of the debugger we can check how the consent indicators have changed based on the preferences expressed.
As a counter-test, we can activate all the purposes at will, except those necessary to activate the Pixel, and verify that it actually remains blocked.
we tick all the purposes except ad_storage which is set up for the activation of the Facebook Pixel
So let's go back to the debugger and check that the consensus indicators are set accordingly:
Finally, we verify that the Facebook Pixel remains deactivated because the necessary consent indicator has not been provided.