Install the container — once
Create the GTM container, put the snippet in the right place, and prove it loads exactly one time.
Create the container
- Go to tagmanager.google.com and create an account (your company) and a container (one per website; target platform Web).
- The dialog that appears holds the two snippets. You can always get them back from Admin → Install Google Tag Manager.
- Note the container ID:
GTM-XXXXXXX. It's public — it's in the page source of every site that uses it — so don't treat it as a secret, but do keep it in a Constant variable rather than typing it around.
Put the snippet in the right place
The first snippet goes as high in <head> as you can get it — ideally right after the charset meta tag. The second (the <noscript> iframe) goes immediately after the opening <body> tag.
Position matters more than people think. GTM loads asynchronously, but it can't fire a page_view until it has loaded, and it can't catch a click that happened before it was listening. The scanner reports the time to GTM's first byte for exactly this reason; anything past a couple of seconds on a normal page means the snippet is buried under something heavy.
On platforms:
- Shopify — do not paste the snippet into
theme.liquidif you can avoid it; use the Customer Events / Web Pixels surface, or the official Google & YouTube app for the standard pixels. Checkout pages don't run theme code. - WordPress — the plugin ecosystem is where duplicate installs come from. Pick one mechanism: theme header, or a GTM plugin, or a SEO plugin's "header scripts" box. Not two.
- Webflow / Squarespace / Wix — the built-in "custom code → head" box.
- Next.js / React apps — a
<Script strategy="afterInteractive">in the root layout, and remember that route changes don't reload the page: you'll push apage_view-style event on navigation yourself.
Prove it loaded once
This is the step that gets skipped, and it's the step that matters.
In the browser: open DevTools → Network, filter gtm.js, reload. You want exactly one request per container ID. Two rows with the same id=GTM-… means the snippet is on the page twice — and every tag inside it will fire twice, forever, silently.
In the console: type google_tag_manager and expand it. The keys are the container and measurement IDs currently loaded. If a G- ID appears here and you also see a hardcoded gtag/js?id=G-… request in the network tab, GA4 is installed two ways.
From outside: run the page through the Tracking Health Scanner. "GTM container loaded 2 times" and "gtag.js for G-… loaded 2 times" are two of its critical findings, and it catches them without you knowing what to look for.
The three doubles, one more time
Because this is the most common way tracking goes wrong, here they are in the order they appear in the wild:
- Same GTM snippet twice — theme + plugin. Fix in the site, not the container.
- Hardcoded gtag.js + GTM Google tag for the same
G-ID. Remove one; the GTM one is easier to manage. - Two Google tags inside the container for the same ID — usually "GA4 – Config" and "GA4 – Config (copy)". The auditor flags this one.
A container installed once, with one Google tag, sending one page_view. Everything else in the course builds on that being true.