Introduction to Google Tag Manager (GTM)
Google Tag Manager (GTM) is a tool designed to help website owners organize and deploy scripts and tags on their site. When using GTM, websites are still subject to global data regulations such as the GDPR, PIPEDA, CCPA, and more.
Businesses under these regulations who use GTM to deploy third-party tracking technologies (e.g., Google Analytics, Facebook Pixel, LinkedIn, AdWords, etc.) must prevent them from triggering until site visitors have given their consent to their use.
A word about Google Tag Manager Consent Mode
GTM’s consent configuration allows users to categorize tags so that they are fired only under the right conditions when site visitors give consent. By connecting Consent Management Platforms (CMPs) — such as Termly — to Consent Mode, you can streamline the entire process and mitigate regulatory risks.
GTM + Termly
Termly offers a GTM template that acts as a translator to communicate your users’ consent preferences with GTM as they come to your site and interact with Termly’s consent banner. To get started, follow the steps in the guide below:
1. Install Termly’s Consent Management Platform
1.1 Scan your site for cookies
If you haven’t done so already, you will need to scan your site for cookies:
Sign in to your Termly dashboard.
Start a website scan by clicking Consent Management, then click Scan Report.
Click Scan Now to start your website scan.
Once your scan is complete, your cookie report will be generated. Review your site’s cookies and their classifications, and make any changes necessary.
1.2 Install Termly consent banner code snippet
Next, you will need to install your Termly consent management platform code snippet. You can do this in one of two ways:
Install the Termly consent banner script tag directly on your page, before the GTM snippet (recommended).
Serve the Termly consent banner script tag through Termly's GTM template (see step 2.4.6).
Note: We do not recommend enabling Termly’s Auto Blocker if you use GTM as it can interfere with GTM’s ability to serve scripts.
2. Install the Termly Consent Management Platform Template
Use Termly’s native Google Tag Manager template to automatically read user consent preferences and manage tag behavior anywhere your banner is installed.
2.1 Add Consent Mode template to your workspace
To install Termly’s Consent Management Platform template:
Click on Templates in the left hand menu of your GTM workspace
Click Search Gallery
Search for “Termly”
Select “Termly Consent Management Platform”
Click Add to Workspace
2.2 Create new event trigger "userPrefUpdate"
Go to your GTM workspace and create a new trigger
Click Choose a trigger type to begin setup, then click Custom Event.
Under Event name type userPrefUpdate
Trigger should be set to fire on All Custom Events
2.3 Create new event trigger "Termly.consentSaveDone"
Go to your GTM workspace and create a new trigger
Click Choose a trigger type to begin setup, then click Custom Event.
Under Event name type Termly.consentSaveDone
Trigger should be set to fire on All Custom Events
Note: It is normal for the "Termly.consentSaveDone" event to fire twice on page load in some cases. This behavior is designed to ensure accurate consent state updates after initial page load according to factors like the user's region and previous consent state.
2.4 Add the Template tag
Go to Tags
Create a new tag and select Termly Consent Mode in Tag Configuration
Click Triggering, then click New / +
Add Consent Initialization - All Pages
Add userPrefUpdate
Optional: if you want to install the Termly script tag along with the template, select 'Inject Termly consent management platform script tag' then paste in your website UUID.
3. Configure Consent Checks
If you do not see consent checks in your tag manager environment, you may need to enable the feature from Container Settings > Additional Settings > Enable consent overview
3.1 No additional consent required
To configure tags where no additional consent is required for them to fire (e.g., Essential tags, or those with Built-in Consent checks), navigate to the Tags tab, and for each tag do the following:
Click on the Tag name you wish to update
Click into Tag Configuration at the top
Open Consent Settings > Additional Consent Checks
Select ”No additional consent required”
3.2 Non-Essential Tags
To configure tags where additional consent is required for them to fire (e.g., Non-Essential tags), navigate to the Tags tab, and for each tag do the following:
Click on the Tag name you wish to update
Click into Tag Configuration at the top
Open Consent Settings > Additional Consent Checks near the bottom
Select “Require additional consent for tag to fire”
Use the mapping table below to select the appropriate categorization
Open Triggering > Firing Triggers below Tag Configuration
Select “Termly.consentSaveDone”
For tags that are expected to trigger only when the page loads, set Tag firing options > Once per page to prevent the tag from firing again each time consent changes.
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