How do I load the cookie banner before Google Analytics in Google Tag Manager?
This article is for people who manage Google Tag Manager (GTM) and want the Intastellar cookie banner to run before tags like Google Analytics or ads.
Use a different path if:
- You use the WordPress plugin only — you may not need GTM for the banner itself; see WordPress.
- Someone edits HTML on the server — they can follow JavaScript install guide instead.
You need edit access to the right GTM container for your site.
What this setup should achieve
GTM is where many teams load Google Analytics, Ads, Meta, and more. Intastellar Consents should run early so the visitor sees a real choice before those tags treat the visit as fully consented.
What success looks like in practice:
- The banner appears (valid privacy URL in the snippet).
- Consent state exists before tags that write non-essential cookies fire.
- Tags that should wait actually wait — Consent Mode defaults, trigger conditions, or tag sequencing you maintain in GTM.
This page does not replace legal advice; it helps you avoid the common failure mode: “banner exists, tags already fired.” For how Consents fits your stack, see Intastellar Consents on intastellarsolutions.com.
What you need ready
- The same script as on JavaScript install guide: the
window.INTAblock plus the line that loadsuc.js(your marketer or web person can copy it from there and adjust placeholders). - A valid privacy policy URL inside that block — otherwise the banner may not appear.
- Agreement in your team that analytics and marketing tags will fire only after consent is available — not at the same time as the banner.
What to do (simple checklist)
- In GTM, create a Custom HTML tag.
- Paste the full snippet from JavaScript install guide (both the configuration
<script>and theuc.jsline). - Set the tag to fire on Consent Initialization – All pages (or your container’s equivalent early trigger so it runs before other tags that set cookies).
- Publish the container and test in Preview mode and in a private browser window.
- For Google Analytics, Ads, Meta, etc., use triggers that respect consent — do not let them run in a race with the banner.
If you are unsure which trigger to use, ask whoever owns compliance or analytics in your organisation; the goal is: banner first, then optional tags.
After publish: what “good” looks like
In GTM Preview and a private browser:
- The Consents tag runs at Consent Initialization (or your earliest safe equivalent).
- Analytics / marketing tags do not beat the banner in a race on a cold visit.
- After the visitor accepts, tags that should run do run.
Verify with Preview and DevTools
- Tag Assistant / Preview: Confirm tag order and consent events on a fresh container version.
- Browser Network tab: On first load before accepting, check whether requests to analytics or ad domains are already going out. If they are, move or block those tags until consent is granted.
Again: this is a technical check. Your organisation still owns legal interpretation.
Common questions
The banner never appears in GTM
Usually the privacy policy URL inside window.INTA is missing or invalid. Open JavaScript install guide and check the Full snippet for paste section.
Analytics fires before I see the banner
The Consents tag is firing too late. Move it to Consent Initialization (or the earliest safe step your container offers) and delay other tags until consent state is set.
Who should paste the HTML — marketing or IT?
Whoever normally maintains GTM should paste it, using the exact block from JavaScript install guide. IT may need to approve container publishes.
Related
- JavaScript install guide (copy-paste snippet)
- Consents overview & FAQ
- Customize (script sites)
Last updated