How to Integrate Google Tag Manager (GTM) with Captain Compliance

Edited

Google Tag Manager is the recommended way to deploy Captain Compliance and enforce consent on your website. This article explains how the pieces fit together and the order to set them up in. Each step links to its own detailed article.

Why GTM

Captain Compliance supports several deployment models, but GTM is preferred wherever it’s feasible. With GTM, consent is enforced before a script runs rather than after a cookie is set. That gives you more predictable and defensible enforcement, a clean fit with Google Consent Mode, and precise control over when each tag executes.

How it works

The setup uses the Captain Compliance CMP template together with GTM’s native consent settings.

  • The Captain Compliance tag, created from the Captain Compliance CMP template. It loads the banner, sets Google Consent Mode defaults for the visitor’s region at Consent Initialization, and sends consent updates when the visitor makes a choice or a stored preference is found. It also honors Global Privacy Control (GPC).

  • Google tags (Google Analytics, Google Ads, Floodlight, the Google tag, Conversion Linker). These have consent checks built in and adjust their behavior to the consent state on their own.

  • Every other tag (Meta, TikTok, Reddit, Microsoft UET, chat widgets, custom HTML and so on). These have no built-in checks, so you tell GTM which consent categories each one requires using the tag’s Consent Settings. GTM then decides per tag whether it may run.

  • The CC - Consent Ready trigger. Tags that load on every page tend to fire before the visitor’s consent state is known. This trigger fires once the banner has resolved it, so early-loading tags can be moved onto it and fire at the right moment instead.

  • A GPC detection variable that lets the template apply GPC from the very first event on the page.

The finished Captain Compliance tag in GTM:

The Captain Compliance CMP tag in GTM, firing on Consent Initialization - All Pages

Setup order

  1. Install the template and create the Captain Compliance tag.

  2. Confirm your consent model and regional defaults in the Captain Compliance dashboard, and understand how Captain Compliance categories map to Google Consent Mode.

  3. Assign a consent setting to every tag in the container. Google tags get No additional consent required; everything else gets the categories it needs. Use Consent Overview to do this in bulk and to confirm nothing is left unreviewed.

  4. Move early-loading tags that require consent onto CC - Consent Ready.

  5. If one container serves several domains, create one Captain Compliance tag per domain.

  6. Test every combination before publishing: default load, GPC, allow and reject, from both an opt-out and an opt-in region.

Consent Overview in GTM shows each tag’s built-in and additional consent requirements in one place:

GTM Consent Overview listing each tag with its built-in and additional consent requirements

Other approaches

Trigger-based gating

Instead of native consent settings, tags can be gated with custom triggers built on the events Captain Compliance pushes to the data layer. This gives finer control over timing, such as firing a tag the instant a visitor clicks Allow, at the cost of a more complex setup. See How to Gate GTM Tags with Captain Compliance Consent Events (Advanced).

Scripts outside GTM

Hard-coded, inline, or SDK-injected scripts aren’t controlled by GTM at all. For those, use the Captain Compliance execution-gating helper. See How to Gate Non-Essential Scripts and Beacons Using Explicit Consent Logic.

Tools and support

Captain Compliance provides the GTM template, a GPC detection variable snippet, and the execution-gating helper for scripts outside GTM. If you’d like help designing your container structure, or would rather not do a fully manual implementation, contact your Captain Compliance representative.

Related articles