Sprint #167, Sprint #168, Sprint #169
One of the recommendations from the GDPR & Cookies 2021 investigation is to apply Google's Consent Mode on Planet 4. We need an evaluation from the development team regarding the feasibility and easiness of this implementation.
Follow the table below to configure Google's Consent Mode according to user's preferences:
|Action||User story||consent||analytics_storage||ad_storage||dataLayer event|
|Default Consent||When the user lands on the website||default||denied||denied||defaultConsent|
|Update Consent||When the user accepts the cookies banner or when the user manually allow both types of tracking (at the Privacy page)||update||granted||granted||updateConsent|
|Update Consent||When the user allows only Planet 4 necessary cookies||update||denied||denied||updateConsent|
|Update Consent||When the user allows only analytics tracking||update||granted||denied||updateConsent
|Update Consent||When the user allows only advertising tracking||update||denied||granted||updateConsent|
|Update Consent||When the user manually removes all types of tracking (manually at Privacy page)||update||denied||denied||updateConsent
Note: Important to keep the existing dataLayer event 'cookiesConsent' when the user clicks in the "Got it" button. We are using this event to track clicks in Google Analytics.
Consent-aware tag behavior must be configured on every page of your website. On each page, there are usually two points where this is configured:
- On page load
When the page loads, you should only use measurement capabilities that align with your users expectations. This is configured through the gtag('consent', 'default', ...) command.
- After visitor provides a consent status, or if consent status is known
After the visitor provides their consent status (or if it was persisisted from a previous page load), enable the measurement features they have consented to (such as reading/writing cookies) through the gtag('consent', 'update', ...) command.
To adjust the default measurement capabilities, you will need to do the following on every page of your site before any tags fire:
- Ensure the dataLayer variable is defined.
- Ensure the gtag function is defined.
- Use the gtag('consent', ...) command to set the measurement capabilities.
- Send a default_consent event using dataLayer.push.
For example, to deny ad_storage and analytics_storage by default:
This will set the default values for 'ad_storage' and 'analytics_storage' to 'denied'. For full details on supported keys see consent in the API reference.
Note: If you don't explicitly set a capability to 'denied', it will default to 'granted'.
When your users provide consent, commonly through interacting with a consent banner, or their consent status is known from a previous page load, update your tags behavior with the gtag('consent', 'update', ...) command. For example, for a user that has granted consent to use advertising cookies:
Only fields that are provided to the update call will be changed. Above, only the 'ad_storage' value was changed. If 'analytics_storage' was set to 'denied' (like in configure default behavior), it would still be denied after this call. It is up to you to ensure the correct values are set for all consent keys. For full details on supported keys, see consent in the API reference.
This command should be called as soon as possible on every page. After the user indicates their consent, you should persist their choice and call the update command accordingly on subsequent pages.
Once implemented, the Consent Mode will immediately start working with all Google’s tags implemented via Google Tag Manager. This will potentially cause disruptions to the collection of data on both the global and local Google Analytics properties.
With this in mind, we shouldn’t enforce this solution to all websites by default. We should recommend NROs to apply these settings, but every local office should do their own due diligence and decide whether or not to follow our recommendations.
A solution for this would be to create a checkbox on Planet 4 analytics settings to enable or disable the entire implementation of Google’s Consent Mode. Example:
[X] Enable Google’s Consent Mode mechanism
--> Make sure to purge CloudFlare cache (if needed)
- How long it would take to implement Google's Consent Mode to Planet 4 consent mechanism?
- Are there any disadvantages to this solution?
- How feasible it is to make the entire implementation optional for admins (create a new setting on Planet 4 Analytics that enables/disables this implementation)?
- Consent Setting in Google Tag Manager, by Simo Ahava
- Consent Mode Implementation , Google Developer Documentation
- Consent Configuration, Google Tag Manager Documentation