Overview
CookieBeam has a template in the Google Tag Manager Community Template Gallery. It sets the Consent Mode defaults, applies a returning visitor's saved choice right away, and loads the CookieBeam banner. It can also forward consent signals to Microsoft Clarity and UET (off by default) and set different defaults by region.
The template doesn't block tags on its own. Consent Mode only governs tags that actually read it, so you'll still need a consent rule on each of your other tags (details below).
What the template does
Google Consent Mode v2
Sets defaults and sends updates for ad_storage, analytics_storage, ad_user_data, ad_personalization and the other consent parameters
Microsoft Consent Mode
Optional, off by default: forwards consent signals to Microsoft UET and Clarity
Regional defaults
Set different default consent states per country or region, covering the moment before the banner loads
Returning visitors
A returning visitor's saved choice is applied immediately, with no wait for the banner
Installation steps
Copy your Banner ID
In the CookieBeam dashboard, open your banner and go to Deployment > Install. Choose the Google Tag Manager tab and copy the Banner ID.
Add the template from the gallery
In GTM, go to Templates > Search Gallery, search for CookieBeam, and choose CookieBeam Consent Mode. Review the permissions it requests and click Add to workspace.
Create the tag
Go to Tags > New > Tag Configuration and pick CookieBeam Consent Mode. Paste your Banner ID. The tag won't load anything without it. Wait for Update defaults to 2000 ms (how long Google tags wait for the consent update); keep it at 500 ms or higher.
Set the trigger
Under Triggering, pick Consent Initialization – All Pages and make it the only trigger. This trigger type fires before all others, so the consent default is in place before any other tag runs.
Regional defaults (optional)
Expand Regional Consent Defaults to set different default states by country or region; leave the region field blank for the global default. Keep the global default denied unless you have a specific reason to change it. The banner's own regional rules decide what each visitor sees; these defaults only cover the moment before the banner has loaded.
Turn on Consent Mode in CookieBeam
In the dashboard, open the banner's App Integrations, turn on Google Consent Mode, click Save Consent Mode Settings, and publish the banner.
Preview, save and publish
Use GTM Preview to test a fresh visitor, acceptance, rejection and withdrawal. Check the consent state and the requests your tags send in each scenario. Then submit and publish the container version.
Google Consent Mode v2
Google requires Consent Mode signals, including ad_user_data and ad_personalization, for advertising features with visitors in the EEA and UK. See Google's EU user consent policy and the Consent Mode documentation. The template sends both the defaults and the updates. Google tags that read Consent Mode, such as GA4 and Google Ads, follow them automatically. Consent Mode can let tags send cookieless requests while consent is denied; it doesn't stop every request.
Without regional overrides, the template's global default starts ad_storage, ad_user_data, ad_personalization, analytics_storage and personalization_storage as denied, and functionality_storage and security_storage as granted. See Google Consent Mode for the full behaviour and the Consent Mode v2 guide for background.
Consent Mode parameters
| Parameter | CookieBeam category | Purpose |
|---|---|---|
| ad_storage | Marketing | Advertising cookies (Google Ads, remarketing) |
| analytics_storage | Analytics | Analytics cookies (GA4 measurement) |
| ad_user_data | Marketing | Sending user data to Google for advertising |
| ad_personalization | Marketing | Personalised advertising and remarketing |
| functionality_storage | Functional (or Preferences, when the banner has no separate Functional category) | Storage that supports site functionality |
| personalization_storage | Preferences | Personalisation features |
| security_storage | Necessary | Always granted (security features) |
Microsoft Consent Mode (Clarity and UET)
Microsoft Consent Mode is off by default. Turn on Microsoft Consent Mode in the tag to forward consent signals to Microsoft UET and Clarity as well. Leave it off if you don't use either. For how each Microsoft product uses the signal, see the Microsoft Consent Mode guide.
Configure your other tags
Every tag that collects data needs its own consent rule. Without one, a tag fires on its trigger regardless of the visitor's choice.
Google tags (GA4, Google Ads, Floodlight)
Leave the built-in consent checks on
Google tags check Consent Mode on their own. In each tag, open Advanced Settings > Consent Settings and confirm it still uses the built-in checks.
Do not override them
Don't set a Google tag to No additional consent required unless you've made that decision deliberately.
Tags from other vendors
Require additional consent
These tags don't read Consent Mode. In Advanced Settings > Consent Settings, choose Require additional consent for tag to fire and pick the matching storage type (ad_storage for an advertising pixel, for example).
Or fire from CookieBeam's events
Use the CookieBeam consent events as the trigger instead of All Pages; see GTM data layer events.
Environments and the container-file fallback
The template always loads the version published to production. To test a staging version, use a script tag with the environment loader on your staging site instead. If you can't use the gallery, the install page has a container file you can download; import it with Admin > Import Container > Merge, double-check the Banner ID and trigger, and watch for duplicate consent tags.
Testing your setup
Testing checklist
Banner appears on page load
Open the site in a private window and confirm the banner shows
CookieBeam fires on Consent Initialization
In GTM Preview, check that the CookieBeam tag fires on the first event
Defaults match what you set
The Consent tab should show ad and analytics types denied before a choice; functionality_storage and security_storage start granted unless you changed them
Consent updates on acceptance and rejection
Accept in one window, reject in a fresh one, and confirm the Consent tab shows the correct update each time
Other tags follow their rules
Confirm each tag fires or stays blocked as expected, and check the requests in the browser's Network panel
The choice persists
Reload the page and confirm the choice is still remembered
IAB TCF with GTM
IAB TCF is an optional second consent layer for publishers whose ad partners ask for a TC string. Most sites don't need it. It's a setting on the banner, not on the GTM tag, and it works alongside Consent Mode: Google tags keep following the Consent Mode signals, while TCF adds the __tcfapi interface and a vendor list for TCF-participating vendors. CookieBeam is a registered CMP in IAB Europe's TCF (CMP ID 526); registration is separate from compliance, and TCF here covers the web only.
Turn on TCF
Check your plan
TCF is part of the IAB TCF and GPP feature, available on Professional plans and above.
Open the Frameworks section
In the dashboard, open the banner, go to the Consent tab, and find the Frameworks section under Consent frameworks.
Turn it on
Enable Use IAB TCF v2.4 for this banner, enter the Publisher country code, and choose your vendors. If you serve Google ads, include Google Advertising Products (vendor 755). Google Additional Consent is a separate toggle in the same card.
Save and publish
Click Save TCF settings, then publish the banner. Settings take effect only after publishing.
Two things to keep in mind when loading CookieBeam through GTM with TCF on. First, the __tcfapi stub only exists after the CookieBeam tag has fired, so an ad tag that runs earlier won't find it. With a script tag above your ad tags the stub is there from the start. If TCF matters for your ad stack, prefer the script tag. Second, for personalised ads to visitors in the EEA, the UK and Switzerland, Google AdSense, Ad Manager and AdMob require a CMP from Google's own certification programme, which is separate from IAB registration. CookieBeam is a Google-certified CMP for web; see the TCF setup docs and Google's publisher requirements. Background: What is TCF, TCF for publishers, TCF vs Consent Mode v2 and Google Additional Consent.
Troubleshooting
Banner not showing?
- Check that the CookieBeam tag fires in GTM Preview
- Verify the Banner ID: it's a UUID shown on Deployment > Install; copy it rather than typing it
- The template loads the version published to production, so make sure the banner is published
- Check the browser console for JavaScript errors
Tags firing without consent?
- Confirm the CookieBeam tag uses Consent Initialization – All Pages, not All Pages
- Check that each non-Google tag has a consent rule in Advanced Settings
- Keep in mind that Google tags can send cookieless requests while consent is denied
- Scripts hard-coded in the page aren't managed by GTM: mark them
type="text/plain"withdata-category, see script blocking
Consent Mode not working in GA4?
- Turn on Google Consent Mode under the banner's App Integrations and publish
- Confirm Google Consent Mode is on in the tag
- Run
window.CookieBeamGTM?.getConsent()and inspectwindow.dataLayerbefore and after a choice
Frequently asked questions
Should I install through GTM or with a script tag?
Use a script tag in <head> if you can edit the page: it starts before GTM and can hold back every tag GTM loads. GTM is for when you don't have that option.
Does the template block my tags?
No. It sets the Consent Mode defaults and updates. Google tags follow them; other tags need their own consent rules.
Which trigger should the CookieBeam tag use?
Consent Initialization – All Pages, and only that trigger.
Can I test a staging banner through GTM?
No. The template always loads the production version. Use a script tag with the environment loader on your staging site instead.
Do I need TCF?
Only if your ad partners ask for a TCF consent string. It's a banner setting on Professional plans and above, not part of the GTM tag.