What this article covers:
This article explains how to make Google Tag Manager (GTM) tags fire only when a visitor has given consent through the Usercentrics CMP. It covers two configuration methods, when to use each, and how to verify everything is working.
Important:
Google Consent Mode only affects the tracking behavior of Google products. Non-Google scripts and tags must be configured to be consent-aware using Option A: Consent Variable + Trigger.
Before starting, confirm all of the following:
- The Usercentrics CMP script is installed on your website. If not: Implementing Usercentrics CMP v3 using Google Tag Manager
- Google Consent Mode is enabled in your Usercentrics Admin Interface under Configuration > CMP Settings.
- The service you want to configure (e.g. Google Analytics 4) has been added to your Usercentrics Admin Interface under Data Processing Services.
- You know the exact service name as it appears in the Usercentrics Admin Interface, including spelling, capitalization, and hyphenation.
- The GTM tag for that service already exists (or you are creating it now).
Which method should I use?
| I am implementing… | Use |
|---|---|
| Advanced Consent Mode: for native Google tags (Google Ads, Google Analytics, Floodlight, Conversion Linker) | Option B: GTM Consent Settings |
| Basic Consent Mode: for any other service (e.g. LinkedIn, Hotjar, Facebook Pixel) | Option A: Consent Variable + Trigger |
Option A: Consent Variable + Trigger (recommended for most services)
Use this for any third-party service. You will create three components and link them together: a Tag, a Variable, and a Trigger.
Step 1: Create the Tag
- In GTM, go to Tags and click New
- Name the tag after the service, for example,
Google Analytics 4 Tag. - Click Tag Configuration and select the appropriate tag type. For GA4, select Google Tag
- Paste your Measurement ID (e.g.
G-XXXXXXXXXX) in the Tag ID field. - Go to Advanced Settings → Tag firing options and select Once per page. (Note: If the service needs to fire more than once per page view, select Unlimited instead. Once per page is the Usercentrics recommended default.)
- Save the tag. You will add the trigger in Step 3.
Step 2: Create the Consent Variable
This variable reads the visitor's consent status for this specific service from the GTM data layer.
- Go to Variables → User-Defined Variables and click New.
- Name the variable after the service, for example,
Google Analytics 4 Variable. - Click Variable Configuration and select Data Layer Variable.
-
In the Data Layer Variable Name field, enter the exact service name from your Usercentrics Admin Interface, for example,
Google Analytics 4.⚠️ The name must match exactly, including spelling, capitalization, and hyphenation. A mismatch means the variable will always return
falseand the tag will never fire. - Check Set Default Value and set the default to
false. - Save the variable.
Step 3: Create the Consent Trigger
This trigger listens for the Usercentrics consent event and checks whether the visitor has opted in for this specific service.
- Go to Triggers and click New.
- Name the trigger, for example,
Google Analytics 4 Trigger. - Click Trigger Configuration and select Custom Event.
- In the Event Name field, enter
consent_status.*and check Use regex matching. - Under This trigger fires on, select Some Custom Events.
- Set the condition:
Google Analytics 4 Variablecontainstrue. This ensures the trigger only fires if the visitor has consented to this service. If they have not consented, the variable returnsfalseand the tag does not fire. - Save the trigger.
Step 4: Connect the Trigger to the Tag
- Open the tag you created in Step 1.
- In the Triggering section, remove the default All Pages trigger and add the trigger you created in Step 3 and save the tag.
- Publish your GTM container to make the changes live.
Please note
Repeat for each service. Each service needs its own variable and trigger. The structure is always the same, only the service name changes.
Option B: GTM's Built-in Consent Settings (Google tags only)
Use this method only for native Google tags (Google Ads, Floodlight, Conversion Linker). These tags support Advanced Consent Mode natively and have built-in consent checks.
Please note
This method does not apply to third-party tags. For those, always use Option A.
For a deeper explanation of the difference between Basic and Advanced Consent Mode, see Advanced and Basic Google Consent Mode v2.
Step 1: Create the consent trigger
- Go to Triggers and click New.
- Name it, for example,
Consent Status. - Select Custom Event as the trigger type.
- Enter
consent_status.*in the Event Name field and check Use regex matching. - Leave This trigger fires on set to All Custom Events.
- Save the trigger.
Note: If your tag uses an interaction-based trigger (e.g. clicks or link follows), you do not need to create or replace the trigger, only page-view based triggers need to be swapped.
Step 2: Configure the tag's Consent Settings
- Open the tag you want to configure.
- Scroll to Advanced Settings → Consent Settings (BETA).
- Select Require additional consent for tag to fire and enter the appropriate consent category (e.g.
ad_storage). - Replace the All Pages trigger with the
Consent Statustrigger from Step 1. - Save the tag and publish your container.
How to verify your setup
After publishing, use the Google Consent Mode Checker in your Usercentrics Admin Interface to confirm your implementation is correct:
- Log into the Usercentrics Admin Interface.
- Go to Configuration → CMP Settings.
- Scroll to the Google Consent Mode Status section and run a check.
You can also verify using Google Tag Assistant:
- Open tagassistant.google.com and enter your website URL.
- Check that the
consent_statusevent appears in the event list. - Click the Consent tab and confirm the parameter values are set correctly for both the default and update events.
Frequently asked questions (FAQ)
- Confirm the service name in the GTM variable exactly matches the name in the Usercentrics Admin Interface, including capitalization and hyphens.
- Confirm the variable default value is set to
false. - Confirm the trigger uses
consent_status.*with regex matching enabled. - Confirm the trigger condition is set to contains
true(not "equals"). - Confirm the visitor has actually consented to the service in the Usercentrics banner.
- Confirm your GTM container changes have been published (not just saved).
- If still failing, run the Google Consent Mode Checker to identify configuration issues.
Immediately on page load. For returning visitors, Usercentrics reads their stored consent preferences and fires the consent_status event as soon as the page loads, no banner is shown because their choice is already known. The tag fires instantly without any user interaction required.
It depends on which method you are using:
- Option A (Basic Consent Mode): No. Each tag needs its own trigger with its own variable condition, because the condition checks the consent status for a specific service.
- Option B (Advanced Consent Mode): Yes. The Consent Status trigger has no service-specific condition, so it can be shared across multiple native Google tags.
A data drop after implementing consent is expected and normal, tags now only fire when visitors consent. See Less GA4 data after implementing Google Consent Mode v2 for an explanation and ways to recover data using Advanced Consent Mode.
Glossary
- Consent-aware tag
A GTM tag configured to fire only after Usercentrics has confirmed that the visitor consented to that specific service.
- Basic Consent Mode
The tag is fully blocked until the visitor gives explicit consent. No data is sent before consent. This is what Option A configures.
- Advanced Consent Mode
The tag always loads but adjusts its behavior based on consent signals. Built into native Google tags. No manual variable or trigger setup needed for those tags.
- Data Processing Service (DPS)
Any service registered in the Usercentrics Admin Interface under Data Processing Services. The service name entered there must be used exactly when creating GTM variables.
- consent_status event
The GTM data layer event that Usercentrics fires once it knows the visitor's consent choices, either when they submit the banner on a first visit, or immediately on page load for returning visitors whose preferences are already stored.
- Data Layer Variable
A GTM variable that reads a value from the GTM data layer. Used here to check whether a visitor has consented to a specific service, returning
trueorfalse.