Google Tag Manager
This guide is opinionated: one clear path that works for most sites. You inject the same window.INTA + uc.js pair as in Quickstart; GTM only controls when it runs relative to other tags.
Prerequisites
- GTM container installed on the site (
GTM-XXXX). - Values ready for
policy_link,rootDomain,company, and optionalgtagId(if using Google tags with CMP-assisted Consent Mode). - Permission to publish a container version.
Step 1 — Create the Intastellar CMP tag
-
In GTM: Tags → New.
-
Tag type: Custom HTML.
-
Paste both parts from Quickstart:
- Inline
<script>that setswindow.INTA(includegtagIdinsettingsif you use GA4/Ads with this pattern). <script src="https://consents.cdn.intastellarsolutions.com/uc.js"></script>.
- Inline
-
Advanced settings → Support document.write: leave off unless your site specifically requires it.
-
Name the tag clearly, e.g.
Intastellar Consents - CMP.
Step 2 — Trigger: Consent Initialization (required)
- Triggers → New.
- Trigger type: Consent Initialization – All pages (in some workspaces: Consent Initialization with All pages).
Assign this trigger only to the CMP tag from Step 1.
Why this matters: Consent Initialization was added so a CMP can run before tags that behave as if consent were already granted. If your CMP tag uses a standard Page View trigger that runs after GA4 in the sequence, you will see pre-consent hits or cookies—see Debugging.
Step 3 — Google tags: Consent Mode + tag settings
If you use GA4, Google Ads, or other Google tags:
- Set
settings.gtagIdinwindow.INTAinside the CMP tag (yourG-XXXXXXXXor Ads equivalent as documented in Quickstart). - In each Google tag’s GTM configuration, open Consent settings (or your GTM version’s equivalent).
- Align default and update consent with your legal position—do not “grant all” by default unless counsel agrees. Details and semantics: Google Consent Mode.
Step 4 — GA4 Configuration tag (example pattern)
Exact UI labels change between GTM versions; the intent is:
-
GA4 Configuration (or Google tag) tag with your measurement ID.
-
Trigger: not a bare “All pages” at first paint if that implies full analytics cookies before the CMP—prefer:
- a trigger that fires after consent (e.g. Custom Event when your policy says analytics is allowed), or
- GTM’s built-in consent checks on the tag so the tag respects denied analytics until updated.
-
Consent settings on the tag: require the appropriate consent types for analytics storage / ad storage as per Google’s model.
Concrete GA4 page: Google Analytics 4.
Step 5 — cookie_consent_update (when consent changes)
The banner sends a dataLayer event named cookie_consent_update whenever the visitor changes consent (not only on first page load).
- Triggers → New → Custom Event
- Event name:
cookie_consent_update - Use this trigger on tags that must run at that moment (e.g. push to another system, fire a tag that could not use Consent Initialization alone).
Combine with tag Consent settings and vendor docs where relevant. Inspect the event and payload in GTM Preview after clicking accept/reject in the banner—see Events and API.
Step 6 — Meta Pixel (example pattern)
- Meta Pixel tag (or Custom HTML from Meta).
- Trigger: fires only when marketing/advertising consent is granted in your model—often a custom event or consent-aware condition—not All pages at load before the CMP.
- See Meta Pixel.
Step 7 — Preview checklist (do this on staging)
- Preview the container; open your site.
- In the Tag Assistant timeline, confirm the Intastellar CMP tag fires on Consent Initialization before GA4/Meta fire (if those are configured to wait).
- Before clicking accept in the banner: GA/Ads should not behave as fully consented unless you deliberately configured defaults that way (verify in Preview + Network).
- After accept: expected requests or mode changes should appear.
- Repeat with Reject / minimal consent to confirm restricted behaviour.
Step 8 — Publish
Create a version with a note, e.g.:
CMP: Intastellar on Consent Init; GA4/Meta gated by consent
Common mistakes
| Mistake | Symptom | Fix |
|---|---|---|
| CMP on Page View only | GA4 before CMP in timeline | Move CMP to Consent Initialization |
GA4 + hard-coded gtag.js | Double hits / wrong consent | Use one primary GA path |
| “All pages” on pixel | Meta fires before choice | Marketing trigger only after consent |
Related
Last updated