Google Tag Manager
A GTM community template that loads ConsentTrustee and sets up Google Consent Mode v2 defaults. If you already use GTM on your site, this is the fastest way to add consent management.
This approach means you do not need to edit your website's HTML at all. Everything is managed through the GTM interface.
Setup
1. Import the template
In your GTM container, go to Templates > Tag Templates. Click Search Gallery and find ConsentTrustee. Click Add to workspace.
If the template is not yet in the gallery, you can import it manually: go to Templates > New, click the three dots menu, and select Import. Upload the template.tpl file.
2. Create a new tag
Go to Tags > New. Select the ConsentTrustee template as the tag type. Fill in your domain slug. The API URL defaults to the production URL and you can leave it unless you self-host.
3. Set the trigger
This part matters. Set the trigger to Consent Initialization - All Pages. This is a special GTM trigger that fires before anything else on the page, including other tags. If you use a regular All Pages trigger, your Google Analytics tag might fire before consent defaults are set.
If you do not see Consent Initialization in the trigger list, make sure Consent Overview is enabled in your GTM container settings (Admin > Container Settings > Enable consent overview).
4. Save and publish
Save the tag. Submit and publish your container. The consent banner will appear on your site.
What the template does
When the tag fires (on Consent Initialization), it does two things:
- Sets all Google consent signals to denied by default (except security_storage, which is always granted). This happens synchronously before any other tags run.
- Loads the ConsentTrustee runtime script, which shows the banner and handles consent updates. When a visitor makes a choice, the script calls gtag(consent, update, ...) automatically.
Consent signal mapping
ConsentTrustee maps its consent categories to Google's consent signals like this:
| ConsentTrustee category | Google consent signals |
|---|---|
| marketing | ad_storage, ad_user_data, ad_personalization |
| statistics | analytics_storage |
| preferences | functionality_storage, personalization_storage |
| (always granted) | security_storage |
Making your tags consent-aware
After setting up the ConsentTrustee tag, you should configure your other GTM tags to require consent. Open each tag, go to Advanced Settings > Consent Settings, and add the required consent types.
For example, your Google Analytics tag should require analytics_storage. Your Google Ads tag should require ad_storage. GTM will only fire these tags after the corresponding consent has been granted.
Verifying it works
Use GTM's Preview mode (click Preview in the top right). In the Tag Assistant panel:
- The ConsentTrustee tag should fire on Consent Initialization
- Check the Consent tab to see all consent signals and their current state
- Before interacting with the banner, signals should show denied
- After accepting, signals should update to granted
- Tags requiring consent should move from Not Fired to Fired