All Collections
Consent Management Solution
Google Consent Mode and Termly CMP
Google Consent Mode and Termly CMP
Updated over a week ago

Google’s Consent Mode is used to communicate your users’ consent status to Google. Google services such as Tag Manager, Analytics, Floodlight and Ads adjust their behavior in response to flags set by Consent Mode, respecting users’ choices accordingly.

Consent Management Platforms like Termly can be configured to communicate your users' preferences to the Google tags on your page via Consent Mode. When consent is denied, among other adjustments, tags will not set or read cookies in your browser, will not collect identifying information and will use modelling to fill in the gaps in your data.

How to set up Consent Mode with Termly

There are two possible ways to set up consent mode with Termly's consent management platform (CMP):

1. Enable Consent Mode under your regional Consent Settings in the Termly dashboard

2. Enable Consent Mode with Termly's Google Tag Manager template

Implementation method

Consent default calls

Consent update calls

Regional consent settings in Termly dashboard

Use code example (see below)

Integrated

Integrated

Integrated

Enable Consent Mode in the Termly dashboard

Google Consent Mode can be enabled on a region-by-region basis from the Termly dashboard. Navigate to your consent banner settings and enable 'Google Consent Mode' for any region under your 'Consent Settings'.

When Consent Mode is enabled in your consent settings, gtags will be exempted from blocking by Auto Blocker. This means that gtags will always be allowed to run on page load. If you prefer that gtags are are not exempted by Auto Blocker when Consent Mode is enabled, you can use manual blocking to assign them to the appropriate blocking category.

Configuring consent defaults

When 'Google Consent Mode' is 'On', consent defaults for each consent category must be configured with in-line code, before your Termly embed script. Your consent banner will then make 'update' calls each time the consent state changes on the page.

Changing the default setting for a given category gives you control over how the consent state is configured (either 'denied' or 'granted') on first page load before subsequent 'update' calls are made. Read more about setting consent defaults and other advanced configurations.

<script>
// Define dataLayer and the gtag function.
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}// Default all categories to 'denied' 
gtag('consent', 'default', {
  'ad_storage': 'denied',
  'analytics_storage': 'denied',
  'functionality_storage': 'denied',
  'personalization_storage': 'denied',
  'security_storage': 'denied',
  'social_storage': 'denied',
});
</script>

Consent category mapping

Termly Consent Category

GTM Consent Type

advertising

ad_storage

analytics

analytics_storage

performance

functionality_storage

performance

personalization_storage

essential

security_storage

social

social_storage*

*Not a default GTM consent category

Enable Consent Mode with Termly's Google Tag Manager Template

Termly's official Consent Management Platform template, found in the Google Tag Manager community template gallery, is designed to translate user consent settings from Termly's CMP into Google Consent Mode preferences anywhere Termly is installed.

Step 1. Add the Consent Mode template to your workspace

To install Termly’s Consent Mode template:

  1. Click on Templates in the left hand menu of your GTM workspace

  2. Click Search Gallery

  3. Search for “Termly”

  4. Select “Termly Consent Management Platform”

  5. Click Add to Workspace

Step 2. Create a new event trigger "userPrefUpdate"
Termly fires this event every time user preferences change in the Termly CMP. The template listens for this event and updates the consent state according to user preferences.

  1. Go to your GTM workspace and create a new trigger

  2. Click Choose a trigger type to begin setup, then click Custom Event.

  3. Under Event name type userPrefUpdate

  4. Trigger should be set to fire on All Custom Events


Step 3. Add the Template tag

  1. Go to Tags

  2. Create a new tag and select Termly Consent Mode in Tag Configuration

  3. Click Triggering, then click New / +

  4. Add Consent Initialization - All Pages

  5. Add userPrefUpdate

Now you can make use of GTM's consent configuration options to manage how and when tags are triggered based on user's consent preferences.

Did this answer your question?