Install
Google Tag Manager
Load CookieTrue through Tag Manager with the CookieTrue template, and build triggers on the consent signals it sends.
If you manage your tags in Google Tag Manager and cannot edit the website's code, you can install CookieTrue as a tag. It works, but putting the line directly into your page is more reliable (see the warning below).
#Install with the template
- Download the CookieTrue template.
- In Tag Manager open Templates → Tag Templates → New. In the three-dot menu choose Import and select the file. Save.
- Create a tag of type CookieTrue Consent Banner and enter your site ID. You find it on the Installation page of your website, for example
ct_yoursiteid. - Set the trigger to Consent Initialization – All Pages.
- Submit and publish.
#Prefer a Custom HTML tag?
- Create a tag of type Custom HTML and paste your script line.
- Set the trigger to Consent Initialization – All Pages.
- Under Advanced settings → Tag firing priority enter
1000, so it fires before your other tags.
#Make the other tags wait for consent
CookieTrue sends Google Consent Mode v2 signals, and Tag Manager's built-in consent checks understand them. For each tag that sets cookies:
- Open the tag and go to Advanced settings → Consent settings.
- Choose Require additional consent for tag to fire.
- Add the consent types it needs, for example
analytics_storagefor Google Analytics 4 andad_storagefor Google Ads.
Google's own tags (Analytics, Ads, Floodlight) already check consent by themselves. This step matters most for third-party tags from the template gallery and for Custom HTML tags.
#Triggers on consent changes
Each time a visitor decides, CookieTrue pushes an event to the data layer:
{
"event": "cookietrue_consent_update",
"cookietrue": {
"preferences": true,
"analytics": true,
"marketing": false,
"necessary": true,
"region": "DE"
}
}To fire a tag when a visitor accepts marketing, create a Custom Event trigger named cookietrue_consent_update and add a condition on the data layer variable cookietrue.marketing equal to true.
#See also
- Google Consent Mode: basic and advanced mode.
- Other consent signals: Clarity, Microsoft UET, Meta and TikTok.