Google’s Consent Mode is designed to allow you to comply with international data privacy regulations and respect your site visitors' privacy choices, all while keeping your site working with Google services, such as Analytics and Ads.

Before proceeding, we suggest familiarizing yourself with how Google's Consent Mode works through the following articles:

Note: Google Consent Mode only works with Google’s Global Site Tags (gtag). For example, a Google Analytics gtag contains src="

The easiest way to set up consent mode with Termly's consent management platform (CMP) is to install Termly's Consent Mode template in Google Tag Manager (GTM), described below. 

Alternatively, if you prefer not to use GTM, you will need to add custom code to your site that will respond to a user's preference in Termly and update the Consent Mode settings on the page.

Whether you use GTM or a custom on-page installation, you may need to make slight adjustments to ensure Google’s Scripts always load depending on how you have chosen to block third-party scripts from loading in response to your site visitor’s preferences in Termly’s CMP.

Using Consent Mode with Google Tag Manager

1. Install Termly's Consent Mode template

Termly's official Consent Mode 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.

Learn more about installing Termly with GTM.

1.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 Mode”
  5. Click Add to Workspace

1.2 Create 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

1.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

2. Ensure Google's Scripts always load

Once Termly's Consent Mode template is installed, you need to configure your supported Google scripts so that they always fire without waiting for any additional consent checks. 

2.1 Adjust your GTM setup to ensure your supported Google tags fire on "All Pages."


  1. Click on the Tag name you wish to update
  2. Click into Tag Configuration at the top
  3. Ensure Triggering is set to "All Pages" or the equivalent trigger for your GTM environment
  4. Open Consent Settings > Additional Consent Checks
  5. Select "No additional consent required"

Using Consent Mode with on-page installation

1. Update the current visitor's Consent Mode preferences

You can use Termly's JavaScript callback to get the user's consent preferences any time they land on the page or change their consent settings. Then, create "update" calls to Google Consent Mode to change the consent state according to Google's instructions.

2. Ensure Google's Scripts always load

If you have Auto Blocker enabled, or if you use manual blocking to block scripts from running before your site visitors give consent, you will need to customize your installation to ensure that the relevant Google scripts are never blocked. 

Do this for all of your supported scripts that you want to respond to Google’s Consent Mode.

Auto Blocker Example

If Auto Blocker is enabled, you can customize its behavior by adding or adjusting your custom blocking map, which must be loaded immediately before your Termly embed script on the page:

The example below ensures that all scripts from will be marked as "essential" and will be allowed to run under all circumstances.

<!-- Termly custom blocking map -->
<script data-termly-config>
    “”: “essential”
<!-- Your Termly embed script -->

Manual Blocking Example

If you use manual blocking to determine how scripts are blocked on your page, you should unblock those scripts by setting data-categories="essential" and ensuring the type is set to "text/javascript" on the script tag.

Do this for all of your supported scripts that you want to respond to Google’s Consent Mode.

The example below shows a gtag that is marked as "essential."

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async type="text/javascript" data-categories="essential" src=""></script>