Cluster 15 · Google Tag Manager · Tag Sequencing + Triggers

Google Tag Manager (GTM) Consent Mode v2 Setup & Tag Firing Validator

Configure GTM Consent Overview, Consent Initialization triggers, and custom HTML/pixel tag consent checks so zero marketing tags fire before Consent Mode v2 grants permission.

100% Browser-Side · Zero User-Data Upload · Strict CSP

Compliance & Pre-Consent Control Specification

Control / Signal Compliant Baseline Engineering & Privacy Rationale
Trigger Order Consent Initialization -> Initialization -> All Pages Default-denied script or CMP template MUST run before Initialization and All Pages triggers
Built-In Consent GA4 / Google Ads / Floodlight Google tags natively check `ad_storage`, `analytics_storage`, `ad_user_data`, `ad_personalization`
Additional Consent Require additional consent for Custom HTML / 3P tags Explicitly require `ad_storage` or `analytics_storage` in GTM Tag Settings -> Consent Settings
Preview Mode Check Consent Tab in Tag Assistant Verify On-Page Default shows Denied across all 4 signals before Page View event fires

GTM-Safe Consent Default Before Container Snippet

gtm-head-order.html
<!-- 1. Consent Mode v2 Defaults FIRST -->
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('consent', 'default', {
    'ad_storage': 'denied',
    'ad_user_data': 'denied',
    'ad_personalization': 'denied',
    'analytics_storage': 'denied',
    'wait_for_update': 500
  });
  gtag('set', 'ads_data_redaction', true);
</script>
<!-- 2. Google Tag Manager Container SECOND -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXXXXX');</script>

GTM DataLayer Consent Update Event

gtm-consent-update.js
// Push both gtag consent update AND custom event so deferred 3rd-party GTM tags trigger cleanly:
window.gtag?.("consent", "update", {
  analytics_storage: "granted",
  ad_storage: "granted",
  ad_user_data: "granted",
  ad_personalization: "granted"
});
window.dataLayer?.push({ event: "consent_updated" });

Implementation Steps & Key Insights

  1. Enable 'Consent Overview' in GTM Admin -> Container Settings so every tag displays its built-in and additional consent checks.
  2. Place `gtag('consent', 'default', ...)` above the GTM container snippet (or bind a CMP template tag strictly to the `Consent Initialization - All Pages` trigger).
  3. For non-Google tags (Meta, LinkedIn, HubSpot, Hotjar), set 'Require additional consent for tag to fire' to `ad_storage` or `analytics_storage`.
  4. Verify in Tag Assistant that `On-page Default` is `Denied` before `Container Loaded`.
  • Non-Google Custom HTML tags inside GTM ignore `ad_storage: denied` unless you configure 'Additional Consent Checks' AND wait for a post-grant custom trigger event.
  • If you use 'All Pages' without re-triggering on `consent_updated`, a user who clicks 'Accept All' will miss firing the deferred PageView unless your trigger listens to both or uses CMP update triggers.
  • Also check your CSP (`script-src`) if migrating GTM onto a checkout or SaaS portal.

Common Pre-Consent Pitfalls

  • Configuring 'Additional Consent Checks' on a Custom HTML tag without removing the `All Pages` trigger or adding a `consent_updated` re-trigger.
  • Putting the `gtag('consent', 'default')` block below the GTM `<script>` tag in `<head>`.
  • Leaving `Consent Initialization` empty while third-party tags fire on `Initialization`.
Verify Live: Audit your production site on consent.runglab.dev or grab the $39 ConsentCheck Compliance Pack. Not legal advice.

More GDPR, Consent Mode v2 & GPC Implementation Guides

← Back to GDPR & Consent Mode v2 Hub · ConsentCheck Live Audit → · $39 Compliance Pack → · Cluster 4: Security Headers → · Cluster 11: PCI & SRI →

Frequently Asked Questions

Do third-party GTM tags automatically pause when `ad_storage` is `'denied'`?

No! Only Google tags have built-in Consent Mode checks. Every third-party template or Custom HTML tag requires 'Additional Consent Checks' configured in GTM plus a post-consent trigger.

Why does GTM Tag Assistant warn 'A tag read consent state before a default was set'?

Because `gtm.js` executed before your `gtag('consent', 'default')` call. Move the default-denied script strictly above the GTM snippet in `<head>`.

Can I verify GTM tags don't leak cookies pre-consent?

Yes — run a live scan on https://consent.runglab.dev/?ref=tool-consent-cluster to detect pre-consent cookies and third-party requests.