Google Tag Manager (GTM)
Last updated
Last updated
Google recommends that GTM customers use our "Commanders Act CMP" This template includes the Google Consent Mode feature.
For further information, please read the documentation Google Tag Manager (GTM) - Consent Mode
In this section, you will find a complete guide to integrate Commanders Act Consent banners in your Google Tag Manager
Enclosed you'll find two sample configuration files, a very simple setup that you'll need to reproduce you'll need to reproduce on your site. The first and most common configuration is the gtm_category_template.json, a category-based configuration (example with only 1 category). The other possibility is a vendor-based configuration, with only the Cact allows Statistical variable changing in gtm_partner_template..json.
In GTM, create a new account so as not to overwrite your current configuration.
In this new test account, go to Admin, then on the right side of the screen click on Import Container and select the file attachment gtm_category_template.json
Observe the configuration to constrain a simple Google Analytics page view tag
"Google Analytics Page view" is only a basic tag example, "Cact consent given Statistical" trigger is applied on
"Consent Cact - Start" tag refers to the "Consent Banner - URL" variable, and is the tag that "activates" the privacy module* and is the only tag that will be triggered with a simple All pages trigger. All other tags must have a trigger that includes the user's consent. *if you need more information about setup of your Consent banner, you can read our Consent management starter kit documentation)
"Cact consent given Statistical" which triggers the page view tag as soon as the user has given consent on a first visit. consent has been given by the user on a first visit. The page view hit from consent pushes a tcConsentChanged event in GTM's dataLayer for each interaction with the privacy module
Trigger name
Cact consent given Statistical
Trigger Type
CUSTOM_EVENT
Event name
Cact allows Statistical
This trigger fires on
When the user interact with the consent banner and on each page view
"Cact consent given Statistical" is an arbitrary name, you can call it "Consent on page view for Analytics" or "Consent Analytics".
It is dedicated to a specific category, you will need to create "Cact on page view Advertising" and/or "Consent on page view Functional" for example, depending on your needs.
"Cact consent given Statistical" should also be reproduced and adapted for your other categories and coupled with custom triggers
The trigger should therefore refer to the variable for its category and trigger the associated tag if it returns "allowed"
"Cact - User consent": will return different values, depending of user consent choice (no_consent, optout, all_consent or the list of consent categories IDs accepted by the user)
"Cact allows Statistical": return "allowed" or "refused", depending of the choice of the user *Don't forget to personalize the ID with the value of your own setup on the Commanders Act Platform
"GA4 - ID": Change this value by your own GA4 - ID
"Browser language": will detect the browser language, do not modify this variable. It will be helpful if you have a multi-language website
"Consent banner - URL": to be personalized with the your Consent banners url.
To obtain your privacy banner url, go on the page Sources > Privacy banners > Deploy
You can also have a look on this page for more information
To make your tags are submitted to user consent, you need to verify consent in each of your triggers