Skip to documentation content
CookieBeam

Install with Google Tag Manager

Add the CookieBeam Consent Mode template from the Community Template Gallery, fire it on Consent Initialization, then set up your other tags.

Last updated:

Use this method when you can change tags in Google Tag Manager (GTM) but not the site's HTML. Use the approved CookieBeam Consent Mode template from the GTM Community Template Gallery in your GTM web container.

Choose GTM or a script tag

A script tag placed above the GTM snippet is the stronger setup. It starts before GTM, so it can hold back every tag GTM loads.

California visitors and Global Privacy Control

California's regulations require that an opt-out method address the sale and sharing of personal information. When a visitor sends a Global Privacy Control (GPC) signal, the banner honors it as soon as it loads. Through GTM, the banner cannot load until the container script has started, so advertising and analytics tags that fire on Consent Initialization before the CookieBeam tag can send data before the GPC signal is processed. If your site has California visitors and you use GPC, prefer the script tag in <head> so the GPC check runs before any tag manager loads. If you can only use GTM, make sure no tag with access to personal information fires on Consent Initialization ahead of CookieBeam, and test with GPC enabled in a private window.

Through GTM, CookieBeam starts as the first tag in the container, but later than a script in <head>:

  • Scripts hardcoded in the page outside GTM are not covered. Mark them inert with type="text/plain" and data-category; see Script blocking.
  • A tag that is not consent-aware and fires on Consent Initialization ahead of CookieBeam can still run first.
  • The loader runs only after GTM's own container script has loaded and fired, so CookieBeam starts later and can't hold back scripts that ran during that window. On a slow connection, this adds visible delay before the banner appears.

If you can edit the page <head>, prefer the script tag. If you only have GTM access, use this page.

One install path

Use the GTM template or the script tag, not both. If the CookieBeam script tag is already on your pages, do not also add the CookieBeam template in Google Tag Manager. Two install methods set two Consent Mode defaults, and Google tags may see an incorrect default before the banner loads.

Do not add your own gtag('consent', 'default', ...) call either. The template handles all Consent Mode defaults.

The template does three things, in this order, every time a page loads:

  1. It sets the Google Consent Mode default: every storage type denied except functionality_storage and security_storage, unless you set your own defaults per region.
  2. If the visitor already made a choice on an earlier visit, it applies that choice straight away, so returning visitors do not wait for the banner.
  3. It loads the CookieBeam banner, which shows the banner and sends a Consent Mode update when the visitor's consent is resolved.

Google tags that are consent-aware, such as GA4 and Google Ads, then follow those signals. Consent Mode can allow cookieless requests while consent is denied; it does not automatically block every tag. Tags from other vendors need their own consent settings; see Configure your other tags.

Default correction (core 0.4.5+)

When the banner loads, it checks whether its own defaults differ from what the template set and sends a Consent Mode update for any key that does not match. For example, if the banner keeps functionality_storage denied for a "functional" category but the template granted it by default, core corrects it as soon as it loads.

  1. Open the correct GTM web container and workspace.
  2. In the left navigation, select Templates.
  3. Under Tag Templates, select Search Gallery and search for CookieBeam.
  4. Select CookieBeam Consent Mode, review its requested permissions, and click Add to workspace.

You can also view CookieBeam in the Community Template Gallery. Review future template updates through GTM's normal template update flow.

Configure the tag

  1. Go to Tags → New → Tag Configuration.
  2. Choose CookieBeam Consent Mode from your custom templates.
  3. Paste the public Banner ID shown on the banner's CookieBeam installation page (Deployment → Install, Google Tag Manager tab).
  4. Check the settings below, then save the tag.
SettingDefaultWhat it does
Banner IDEmptyYour public Banner ID. The tag loads nothing without it
Wait for Update2000 msHow long Google tags wait for the consent update before they fire. Values below 100 ms are raised to 100 ms
Redact Ads DataOnWhile ad_storage is denied, Google advertising tags drop advertising identifiers
Pass Ad Click Information Through URLsOffKeeps ad click IDs such as gclid in internal links while consent is pending
Regional Consent DefaultsNoneDifferent default states per country or region. Leave the region empty for the global default
Google Consent ModeOnSets the Google Consent Mode defaults and updates
Microsoft Consent ModeOffAlso passes consent to Microsoft UET and Microsoft Clarity

Keep the global default denied unless you have a reason to change it. The banner's own regional rules decide what each visitor sees; these template defaults only cover the moment before the banner has loaded.

Turn on Google Consent Mode in the banner's settings in CookieBeam as well, under App Integrations, and publish the banner. See Google Consent Mode.

Set the trigger

  1. In the tag's Triggering section, select New.
  2. Choose Consent Initialization – All Pages.
  3. Make it the only trigger on the CookieBeam tag, and save.

Consent Initialization fires before every other trigger type in GTM, including Initialization and All Pages, so the consent default is in place before other tags run.

Configure your other tags

Every tag that collects data needs a consent rule:

  • Google tags (GA4, Google Ads, Floodlight) check Consent Mode by themselves. Leave their built-in consent checks on.
  • Other vendors' tags do not read Consent Mode. In each tag, open Advanced Settings → Consent Settings, choose Require additional consent for tag to fire, and pick the matching storage type, for example ad_storage for an advertising pixel. Or fire the tag from the CookieBeam consent events instead of All Pages; see GTM data layer events.

A tag with no consent rule fires on its trigger whatever the visitor chose.

Preview and publish

Use GTM Preview before publishing. Test a fresh visitor session, acceptance, rejection, and withdrawal:

  1. Open Preview in a private window.
  2. On the first event, open the Consent tab. The CookieBeam tag should have fired on Consent Initialization, with the default states you expect.
  3. Accept and reject in the banner and check that the Consent tab shows the update, and that each tag fires or stays blocked as you intended.
  4. Check the requests your tags send in the browser's Network panel.

Then submit and publish the container version. See Verify your installation for the full checklist.

Environments

The template always loads the banner version published to production. To test a staging version, use a script tag with the environment loader on your staging site.

Alternative: import a container file

If you cannot use the gallery, the CookieBeam installation page offers a web container JSON download with a prefilled consent tag. Use Admin → Import Container, choose the file and workspace, then select Merge and review the import preview. Verify the banner ID and Consent Initialization – All Pages trigger before publishing.

Use either the gallery setup or this fallback to avoid duplicate consent tags. The JSON download is a container file, so it belongs in Import Container, not the template editor's import menu. Manual imports need to be updated when a new template version is released.

Do not use a bare Custom HTML tag

A Custom HTML tag that only loads loader-gtm.js sends no Consent Mode default. Google tags then run without a consent state until the visitor makes a choice, even for a returning visitor who rejected. Use the gallery template or the container file instead.

Use one CookieBeam installation per page: do not also add the loader to the site's HTML.

AltStyle によって変換されたページ (->オリジナル) /