Configuring Google Tag Manager (GTM) for Google Consent Mode v2 is essential for businesses seeking to balance data-driven insights with user privacy preferences. Google Consent Mode allows websites to adjust Google Tag’s behavior based on the user’s consent status. This article explains the necessary steps that need to be taken to configure GTM and modify tag behavior, such as enabling or disabling tracking based on consent signals sent by the CMP – WebToffee Cookie Consent.
The Google Consent Mode operates in two different modes, and the tag behaviors change based on the configured mode. The modes and the tag behaviors are elaborated below:
- Basic Mode – When you use basic consent mode, Google tags don’t load until the user interacts with the consent banner. No data is sent to Google before the user provides consent, and once consent is given, Google tags load and share consent states. If the user doesn’t consent, no data is sent, and Google tags are fully blocked.
- Advanced Mode – In advanced consent mode, Google tags load when a user visits the website or app. Initially, consent is set to “denied” by default, and tags send cookieless pings until the user interacts with the consent banner. Once the user grants consent, Google Tags sends complete measurement data.
Steps to set up GTM to receive consent signals
Step 1: Sign Up/ Create a Google Tag Manager Account
If you don’t have a Google Tag Manager account, sign up for one by visiting Google Tag Manager and follow the account creation process.
Step 2: Create a new container
The Container is where you’ll manage and deploy your website’s tags, triggers, and variables. Follow the below steps to create and install a new container:
- In Tag Manager, click the Accounts tab > Create Account.
- Enter an Account Name and select the Country for the account.
- Enter the Container name and select the container type.
- To create your container, click Create and agree to the Terms of Service
Step 3: Install the container
Upon container creation, install the necessary integration code snippets on your website. Copy and paste the corresponding code snippets into the <head> and <body> tags.
Step 4: Automated mapping of consent types
GDPR Cookie Consent CMP automatically maps the consent types to the cookie categories and sends it to the Google Tag Manager using gtag(). The table below lists the mapping scheme that the CMP uses:
Consent Type | Cookie Category | Purpose |
---|---|---|
ad_storage | advertisement | To enable advertisement cookies. |
analytics_storage | analytics | To enable analytics cookies. |
functionality_storage | functional | To enable functional cookies for website functionality and settings. |
personalization_storage | functional | To enable functional cookies for user personalization. |
security_storage | necessary | To enable necessary cookies for website security and protection, user UI preferences, etc. Such cookies do not require consent. |
ad_user_data | advertisement | To enable advertisement cookies to set consent for sending personal data to Google core platform service. |
ad_personalization | advertisement | To enable advertisement cookies to use data for ad personalization such as remarketing. |
Step 5: Enable consent overview
Enable the Consent Overview feature in GTM. It helps you understand and manage consent settings in your GTM container, ensuring compliance with privacy regulations. This option will provide a visual representation of the tags, categorized into those that are “Consent Not Configured” (no action taken) and “Consent Configured” (with consent settings applied).
- In GTM, go to Admin > Container Settings
- Under Additional Settings, find and select Enable consent overview.
Aligning third-party tag behavior with CMP consent signals
Aligning third-party tags to respond to consent signals sent by a CMP would allow the site owner to modify how this tag behaves alongside your consent tools. All the tags in the GTM will check for the status of the consent types marked as built-in, namely ad_storage, ad_personalization, ad_user_data, and analytics_storage. The site owner can also force the tag to listen to additional consent types by setting the Additional Consent Checks option.
For the third-party tags to align with the consent signals, the site owner must explicitly state the consent type that the tag must listen to from the Additional Consent Checks option.
- In the GTM, go to the Tags tab. Click on the third-party tag, then click on Advanced Settings.
- Click on Consent settings.
- From the listed option, select Require additional consent for tag to fire. Click on the Add required consent button.
- Click inside the text box, and from the drop-down, select the consent type the tag must listen to for firing.
- Click on Save and commit the changes.
The earlier steps will configure the tag to listen to the set consent types. The third-party tags will only fire when the user accepts the appropriate mapped cookie categories in the banner.