Skip to main content
Back to Guides
Compliance20 min readBy Armin Zaribaf

Google Tag Manager and Consent: The Complete Setup Guide for 2026

Everything you need to wire Google Tag Manager to a consent banner: Consent Initialization triggers, the consent template, the Additional Consent Checks refire problem, Consent Mode v2 default and update commands, regional defaults, server-side tagging, and how CookieBeam handles all of it.

Google Tag Manager ships with built-in consent types, a Consent Initialization trigger, per-tag consent checks, a consent overview report, and deep integration with Consent Mode v2. A misconfigured consent setup on a container that serves EU visitors doesn't just risk a fine; it silently corrupts your analytics data.

This guide walks through every layer of GTM's consent architecture, from setting defaults to wiring a server-side container. Where bugs exist, we name them.

GTM's consent system has three layers. Confusing them is the most common cause of broken setups.

Consent Type (Built-In)

GTM recognises a fixed set of built-in consent types that Google's own tags understand natively: ad_storage, analytics_storage, ad_user_data, ad_personalization, functionality_storage, personalization_storage, and security_storage. These aren't arbitrary labels. They're the signals Google tags read to decide what data they can collect. When a consent type is denied, Google tags that depend on it enter a restricted mode: no cookies written, no user identifiers stored.

You can create your own consent types too (arbitrary strings such as marketing_cookies or social_media) for vendor tags that aren't part of the Google ecosystem. Those custom types only take effect through the Additional Consent Checks feature described below.

Consent Check (Built-In Tag Behavior)

Google's own tags already understand the built-in consent types without any extra configuration. A GA4 tag checks analytics_storage automatically: if it's denied, GA4 still fires but runs in a restricted, cookieless mode, sending consent-aware pings with no identifiers. You don't configure this. The critical point: these tags fire regardless of consent state. They adjust their behavior; they don't block themselves.

Additional Consent Checks (Per-Tag Setting)

Tags that aren't consent-aware by default (Custom HTML, Custom Image, third-party vendor templates) need explicit gating. Open the tag's Advanced Settings > Consent Settings, select "Require additional consent for tag to fire," and list the consent types that must be granted. Unlike built-in consent checks, Additional Consent Checks block the tag from firing until those types are granted.

Before any tag can respect consent, the container needs a defined default state. That's the job of the Consent Initialization – All Pages trigger.

Every GTM web container ships with this trigger. It fires before all other triggers, including the standard Initialization trigger. The firing order is:

  1. Consent Initialization: for tags that set default consent state
  2. Initialization: for tags that need to run early (first-party data setup, etc.)
  3. Page View / DOM Ready / Window Loaded: the standard triggers

Your CMP tag, the one that loads the cookie banner and sets defaults, must fire on Consent Initialization. If it fires on All Pages or Initialization instead, there's a race condition: other tags may fire before defaults exist and assume consent is granted.

Step-by-Step: Setting Defaults

  1. Create or open your CMP tag (e.g. a CookieBeam Consent Mode tag, or a custom template).
  2. In the Triggering section, select the Consent Initialization – All Pages trigger.
  3. Configure the tag to set defaults for every consent type you need. On a site that serves EU visitors, the standard starting point is denied for ad_storage, analytics_storage, ad_user_data, and ad_personalization.
  4. Set the wait_for_update parameter (in milliseconds) to tell Google tags how long to wait for a consent update before falling back to defaults. The CookieBeam GTM template defaults to 2000 ms and enforces a 100 ms floor; the integration docs recommend 500 ms or more so Google tags wait for the runtime's update rather than falling through early.

In Advanced mode, defaults control what happens before the visitor interacts with the banner. In Basic mode, tags don't load at all until consent is granted, but defaults still serve as a fallback if the CMP fails to load.

What the Default and Update Commands Look Like

Whether a template or a Custom HTML tag issues them, the underlying commands are the same. This is the default state the CookieBeam GTM template sets when you leave its Regional Consent Defaults table empty: everything denied except functionality_storage and security_storage. wait_for_update is the template's default of 2000 ms.

consent-default.js

When a visitor accepts marketing and analytics but not preferences, the update flips the types that match. Marketing drives ad_storage, ad_user_data, and ad_personalization; Analytics drives analytics_storage; Preferences drives personalization_storage. The CookieBeam GTM template grants functionality_storage and security_storage in its default command and its stored-consent restore. After that, the banner runtime's updates follow the category mapping: functionality_storage tracks the Functional category if one exists, or is granted when Preferences is accepted on a banner with no Functional category. security_storage stays granted in every state.

consent-update.js

You don't normally write these by hand. With the CookieBeam template, the template issues the default command at Consent Initialization and restores any stored consent from a previous visit; the banner runtime then sends a fresh update whenever the visitor makes or changes a choice. On a direct (non-GTM) install the runtime issues both commands itself. If you're wiring a Custom HTML tag manually, it must fire on Consent Initialization – All Pages and the gtag function must already exist on the page. The integration docs show the exact default and update payloads CookieBeam sends for each consent scenario.

If your CMP doesn't offer a GTM template, or you want full control over the consent machinery, you can build one using GTM's consent APIs. Simo Ahava's Consent Mode template is a widely used reference implementation.

The Consent API Methods

GTM exposes four consent-related methods to custom templates:

  • setDefaultConsentState: sets the initial consent state. Accepts an object mapping consent types to 'granted' or 'denied', plus optional region and wait_for_update values. Call this in the default command path of your template.
  • updateConsentState: pushes a consent update. GTM applies the new state as soon as the current event and its associated tags finish processing. Call this when the visitor clicks Accept, Reject, or saves preferences.
  • isConsentGranted: returns a boolean for whether a specific consent type is currently granted. Useful for conditional logic inside a template.
  • addConsentListener: registers a callback that fires whenever a specific consent type changes, receiving the type and its new value.

The "Accesses Consent State" Permission

Any custom template calling these methods must declare the "Accesses consent state" permission in the template's Permissions tab. Without it, the API calls silently fail: no error, no warning, just broken consent. The permission lets you specify read, write, or both for each consent type.

Design Choices for Your Template

  1. Default vs. Update command. Add a dropdown that switches between "Default" (setDefaultConsentState) and "Update" (updateConsentState). The typical pattern is one template used in two separate tag instances.
  2. Region-specific defaults. setDefaultConsentState accepts a region parameter (ISO 3166-2 codes). Call it multiple times with different regions for geography-specific defaults.
  3. Firing trigger. The default instance fires on Consent Initialization; the update instance fires on a custom event the CMP pushes to the data layer.

There are two fundamentally different ways to prevent a tag from firing without consent.

Approach A: Consent-Based (Additional Consent Checks)

Open the tag's Advanced Settings > Consent Settings, select "Require additional consent for tag to fire," and list the required consent types (e.g. ad_storage). The tag stays blocked until those types are granted.

Pros: Clean and declarative. Visible in the consent overview report. Tags fire automatically once consent is granted, with no trigger logic needed for the post-consent path.

Cons: The once-per-page refire bug (next section). Limited to consent types; you can't block on arbitrary conditions.

Approach B: Trigger-Based (Custom Events)

Don't use Additional Consent Checks at all. Instead, trigger the tag on a custom event your CMP fires after consent (e.g. analytics_consent_granted).

Pros: No refire bug, complete control over when the tag executes, and you can combine it with other trigger conditions.

Cons: Requires more manual wiring, and these tags won't appear in the consent overview report, which only covers Additional Consent Checks.

Which to Choose

For Google tags (GA4, Google Ads), use their built-in consent behavior; don't add Additional Consent Checks. For third-party once-per-page tags, read the refire bug section below before deciding. For tags that fire on repeated events (scroll tracking, click tracking), Additional Consent Checks work well.

This is one of GTM's most frustrating behaviors, and it bites experienced implementers.

When a tag has Additional Consent Checks and is tied to a trigger set to fire Once Per Page (or any trigger that fires only once, like Page View), GTM evaluates the trigger first. If the trigger fires but consent is denied, GTM blocks the tag. Correct. But it also records that the trigger has "used" its one firing for this page. When the visitor later grants consent, the trigger won't fire again, because GTM already counted it. The result: the tag sits idle for the rest of that page load.

In practice, picture a visitor who lands on your site, sees the banner, scrolls for half a minute, then clicks Accept. A Facebook Pixel tied to a Page View trigger with Additional Consent Checks for ad_storage will not execute. That conversion is gone.

Workarounds

  1. Switch to trigger-based blocking. Remove Additional Consent Checks and trigger the tag on a custom event your CMP fires after consent (e.g. marketing_consent_granted).
  2. Switch to "All Page Views." The tag fires when consent is eventually granted, but you risk double-firing on SPAs. Use a Custom JavaScript variable as a firing guard to prevent double execution.
  3. Synthetic event after the consent update. Configure your CMP to push {event: 'consent_update_complete'} to the data layer after every updateConsentState call. Bind your once-per-page tags to that event instead. Each tag then executes a single time, right when consent is granted.

Option 3 is the cleanest: it preserves once-per-page semantics while sidestepping the timing problem. Your CMP needs to push this event after every consent update, including for returning visitors whose stored consent is restored.

GTM has a consent overview report that shows how consent is configured across the entire container. To turn it on:

  1. Open Admin > Container Settings in the GTM workspace.
  2. Expand Additional Settings and tick Enable consent overview.
  3. Click Save.

In the Tags view, a shield icon appears in the top-right. Clicking it opens the overview.

What the Report Shows

Tags are grouped into two buckets:

  • Consent Not Configured: tags in the "not set" state. No Additional Consent Checks applied, so the tag relies on its built-in consent behavior (if it has any) or fires unconditionally.
  • Consent Configured: tags where you've explicitly set Additional Consent Checks to either "No additional consent required" or "Require additional consent for tag to fire."

How to Interpret It

The goal is zero tags in "Not Configured" without a deliberate reason. Google tags (GA4, Google Ads) sitting there are fine: they have built-in consent checks. A Custom HTML tag sitting in that bucket, though, fires no matter what the visitor chose, which is a compliance gap.

Go through the list: for every unconfigured vendor tag, either add Additional Consent Checks or gate it with a trigger-based approach. For tags you deliberately want to fire without consent (a strictly necessary first-party script, say), mark them "No additional consent required" so they move into the Configured bucket as a deliberate audit trail.

Google Consent Mode v2 requires four consent signals: ad_storage (advertising cookies), analytics_storage (analytics cookies), ad_user_data (sending user data for ads), and ad_personalization (remarketing lists). All four must appear in both your default and update commands. See Advanced vs. Basic mode for the full comparison.

The v2 signals exist because Google distinguishes storing cookies locally from transmitting user data to its servers. Google's consent configuration guide states that no consent values are set by default and that you are responsible for setting all of them. If ad_user_data or ad_personalization are left unset, enhanced conversions and audience matching may not work as expected, even when ad_storage is granted.

Implementation Checklist

  1. Default all four signals inside your CMP tag's Consent Initialization setup. When the banner groups them behind a single "Marketing" toggle, that toggle should control ad_storage, ad_user_data, and ad_personalization together.
  2. Confirm in Tag Assistant. Check the Consent tab and confirm all four signals appear at each stage: default (after Consent Initialization), update (after the visitor's choice), and on subsequent page views (stored consent restored).
  3. Verify downstream. In GA4, open Admin > Data Streams > Consent settings and confirm it recognises consent mode. In Google Ads, look at the diagnostics page for any signal coverage warnings.

8. Regional Defaults: Different Starting States by Location

Visitors in different jurisdictions can legitimately start from different consent states. Google Consent Mode supports this with the region parameter on the default command, using ISO 3166 country or subdivision codes. A command with a region applies to visitors in those regions; one without it is the global fallback. See Google's consent configuration guide for how overlapping regions are resolved.

How CookieBeam's Template Manages Regional Defaults

  1. The Regional Consent Defaults table. Inside the template's Regional Consent Defaults group you'll find a table where every row maps to a single setDefaultConsentState call. Each row takes a comma-separated list of ISO region codes and a granted/denied value for ad_storage, ad_user_data, ad_personalization, analytics_storage, functionality_storage, and personalization_storage. A row with no region codes becomes the global fallback, covering any visitor who doesn't match a more specific row. security_storage is granted on every row automatically.
  2. Fallback when no global row exists. If the table is empty, the template issues the all-denied default from section 2. If the table contains rows but none of them is a global fallback, the template inserts its own all-denied fallback for unmatched regions.
  3. New rows default to denied. Every column in a new row defaults to denied except functionality_storage, which starts as granted.
  4. The banner runtime takes over next. After the template sets defaults, the banner runtime checks the visitor's location against its regional rules. First-time visitors receive a consent update only when the runtime's own defaults for that region differ from what the template already set; returning visitors get their stored choice restored instead of seeing the banner again.

Two rows in the table produce two default commands, equivalent to:

regional-defaults.js

For how the banner itself adapts by region (text, buttons, hidden banner), see Regional Consent: Running One Cookie Banner Across a Global Audience. Test from each region you've configured; Tag Assistant's Consent tab shows which default was applied.

If you run a server-side GTM container, consent signals travel from browser to server automatically for Google tags. The web container collects consent via the CMP. Google tags in the web container embed consent parameters in the HTTP requests they send to the server container. You don't pass them manually. Server-side Google tags (GA4, Google Ads) read those embedded signals and adjust their behavior.

You don't need a consent banner or defaults in the server container. The web container is the only place consent is collected; the server container just reads the signals it receives.

What the Server Container Does Need

  • Region-specific settings. When your web container sends region-specific defaults (e.g. denied for EEA visitors, granted for US), you must also turn on region-specific settings in the server container so server-side tags read the signals correctly.
  • Vendor tags (non-Google). Vendor tags on the server side (Facebook CAPI, TikTok Events API) don't read Google consent signals on their own. You'll need to add consent logic for them, either through Additional Consent Checks or trigger-based gating. Our server-side consent enforcement guide covers the patterns.

10. How CookieBeam Integrates with GTM

CookieBeam's official GTM template handles consent signal injection for you. Install the CookieBeam Consent Mode tag on the Consent Initialization – All Pages trigger, and it:

  1. Sets defaults for all seven consent types via setDefaultConsentState, using the regional defaults you configure in the template's Regional Consent Defaults table.
  2. Restores stored consent. If the visitor has a saved choice from a previous visit, the template reads the cookie and calls updateConsentState once to restore it, so Google tags receive the right signals before the banner even renders.
  3. Loads the banner from the CDN, which then handles all subsequent consent updates: whenever the visitor accepts, rejects, or changes categories, the banner runtime calls gtag('consent', 'update', ...) with the new state.

One tag covers both Google Consent Mode v2 (all four signals) and Microsoft Consent Mode (Clarity + UET). The category mapping: Marketing → ad_storage + ad_user_data + ad_personalization + UET; Analytics → analytics_storage + Clarity; Preferences → personalization_storage. functionality_storage is granted in the template's default and stored-consent restore; the runtime's subsequent updates grant it only when the banner has a Functional category and the visitor accepts it, or when the visitor accepts Preferences on a banner with no Functional category. security_storage remains granted regardless of the visitor's choice.

Because CookieBeam pushes a data layer event after every consent update, the synthetic-event workaround for the refire bug (section 5) works without any extra configuration. If you trigger third-party tags on CookieBeam's consent events, the bug won't affect you.

For the full installation walkthrough (banner ID, template import, regional config, testing checklist), see the GTM Integration Guide.

Common Mistakes

The same handful of misconfigurations cause most GTM consent failures.

Common GTM consent pitfalls and how to correct them
MistakeConsequenceFix
CMP tag assigned to All Pages or the Initialization triggerTags that depend on consent state can execute before any defaults are set, treating consent as implicitly grantedReassign the tag to fire on Consent Initialization, All Pages
Default command sets only ad_storage and analytics_storageThe two v2 signals (ad_user_data, ad_personalization) are never set, so features like enhanced conversions and audience matching may silently stop workingInclude all four v2 signals in every default and every update command (section 7)
wait_for_update omitted or set too lowGoogle tags read the default state before a returning visitor's stored choice can be restoredKeep wait_for_update enabled; CookieBeam's template uses 2000 ms by default
Adding Additional Consent Checks to a Google tag like GA4 or Google AdsThe tag is completely blocked rather than entering its restricted cookieless mode, which means you also lose consent-mode modelling dataRemove the extra check and rely on the tag's own built-in consent behaviour; Additional Consent Checks are for third-party tags only
Pairing Additional Consent Checks with a trigger that fires only once per pageIf consent is still denied when the trigger fires, the trigger's single firing is consumed and the tag never executes, even after consent arrives (section 5)Fire the tag on a CMP consent event or the synthetic-event pattern described in section 5
A third-party Custom HTML tag left with no consent settings at allThe tag executes unconditionally, ignoring consent state entirelyOpen the consent overview report (section 6) and assign a consent configuration to every third-party tag in the container
Forgetting the "Accesses consent state" permission on a custom templateEvery setDefaultConsentState and updateConsentState call inside the template fails without any error or warningIn the template's Permissions tab, grant read/write access for each consent type the template uses (section 3)
A single global default that grants everything, with no region-specific rowsVisitors in jurisdictions that require prior consent start with tracking already allowedAdd region-specific rows and keep a denied global fallback (section 8)
Consent update values out of sync with the banner's actual categoriesA visitor who accepts sees tags remain blocked, or one who rejects finds tags still runningAfter every banner configuration change, compare the Consent tab in Tag Assistant against the choice the visitor made

Walk through these eight checks after any container change that touches consent.

  1. CMP tag fires at Consent Initialization. In GTM Preview, confirm the CMP tag executes on the Consent Initialization trigger, ahead of every Initialization and Page View tag.
  2. Every v2 signal has a default. Open the Consent tab in Tag Assistant and verify that ad_storage, analytics_storage, ad_user_data, and ad_personalization each show a defined state the moment the page loads.
  3. Updates reach the tags. Click Accept in the banner, then check Tag Assistant: every consent signal should flip to granted.
  4. Consent overview has no surprises. Turn on the consent overview report and confirm that every vendor tag sits in the "Consent Configured" bucket. Any tag you intentionally fire without consent should be set to "No additional consent required" so its presence there is deliberate.
  5. Once-per-page tags still fire after late consent. Start with consent denied, then grant it. Does a conversion pixel gated by Additional Consent Checks actually execute? If it doesn't, move it to trigger-based or synthetic-event blocking.
  6. Server container honours the signals. If you run sGTM, confirm that server-side tags stay idle when the web container transmits denied signals. Open the server container's own Tag Assistant and inspect the consent state on each incoming request.
  7. Returning visitors pick up their stored choice. Accept cookies, then reload. The Consent tab should show granted at Consent Initialization, before the banner has rendered.
  8. Visitors who declined stay blocked. Reject cookies, reload the page, and verify that marketing and analytics tags remain in their denied or restricted state.

A container that clears all eight points is correctly wired. Run the same checklist every time you add or reconfigure a tag; consent setups drift silently, and a periodic compliance check catches regressions before an auditor does.

7 min read

GPP, MSPA & US State Signals: A Publisher's Guide

The US Privacy String you built for CCPA was deprecated in January 2024. GPP, the US National string, and the MSPA replaced it, and getting the signal wrong can be a misrepresentation. Here's how the new US privacy signals move through the ad stack.

5 min read

Building a TCF CMP That Passes IAB Validation

What it takes for a Consent Management Platform to pass IAB Europe's TCF checks: a registered CMP ID, a cleanly decodable TC String, event-listener delivery, and encoding against the right GVL version.

9 min read

How to Migrate Your CMP Without Losing Existing Consent Records

A step-by-step technical guide to switching consent management platforms without losing consent records, triggering mass re-consent, or breaking Consent Mode. Covers export, category mapping, parallel runs, and zero-downtime migration patterns.