Tag Manager QA
Twenty-one Google Tag Manager and conversion-tracking problems, answered the way we would answer them for a client: the fix, exactly, and how to prove in Preview, the Network tab, or DebugView that it actually worked - not just that it looks right.
Firing, events & the data layer
GTM's preview shows my tag firing, so why does the event never show up in GA4?
GTM Preview only confirms your tag executed, not that GA4 accepted the hit. Here is how to check the real network request, fix a missing Configuration Tag link, and verify in DebugView.
Why does my GTM dataLayer variable read as undefined even though I pushed a value before the tag fires?
A Data Layer Variable only sees what is in dataLayer at the moment its trigger evaluates. Here is why async pushes race ahead of page-level triggers, and how to fix it with a dedicated custom event.
Why do I get "dataLayer is not defined" even though the GTM snippet is on the page?
This ReferenceError means code elsewhere on the page reads dataLayer before GTM's bootstrap line creates it. Here is the defensive pattern that eliminates the load-order dependency entirely.
Why won't GTM's preview/debug mode connect, or why does it show no tags firing?
Preview mode fails when a redirect or SPA router strips its debug query parameters, or a CSP/ad blocker blocks the Tag Assistant handshake. Here is how to tell the causes apart and fix each.
Why does gtm.js return a 404 - wrong container ID, blocked request, or something else?
A genuine 404 and a blocked request look similar but need different fixes. Here is how to tell them apart in the Network tab and correct a mistyped or deleted container ID.
Can I run two GTM containers on the same domain, and how do I stop them from conflicting?
Multiple containers do not conflict at the platform level - the real risk is both firing the same downstream tag. Here is how to audit for duplicate destinations and dataLayer key collisions.
Triggers, clicks & SPA routing
Why doesn't my GTM Click trigger fire for clicks on child elements or dynamically added buttons?
GTM's Click triggers evaluate the exact element a click landed on. Here is why nested icons and dynamically rendered buttons get missed, and how to fix the selector and confirm it in Preview.
How do I get GTM to reliably fire a pageview on every route change in a React/Vue single-page app?
GTM's History Change trigger alone produces noisy or incomplete pageview counts in a SPA. Here is the virtual pageview pattern that fires exactly once per real navigation.
What's the correct way to load GTM in a Next.js app using next/script (or @next/third-parties) without breaking CSP?
A raw script tag in _document or a useEffect injection either loads too late or bypasses Next's nonce propagation. Here is the next/script and @next/third-parties pattern that keeps CSP intact.
CSP & page speed
How do I configure a strict Content Security Policy so GTM (and its Custom HTML tags) still runs?
A strict CSP silently blocks GTM at the browser level with no error visible in Preview. Here are the exact script-src, connect-src, and nonce settings that keep GTM and its Custom HTML tags running.
How do I load GTM without it blocking the main thread or tanking my Core Web Vitals?
GTM's own loader is small and async. The real cost is the tags it fires on page load. Here is how to isolate and defer the ones actually blocking your Core Web Vitals score.
Ecommerce & conversion tags
Why does my GTM Enhanced Ecommerce purchase tag never fire on the order confirmation page?
Confirmation pages are often redirect targets or cached templates that never actually push transaction data. Here is how to trace where the ecommerce object breaks and stop double-counting on reload.
Why does my Google Ads conversion tag fail with a 400 status or never call its success callback?
A 400 means the request was rejected as malformed, not blocked. Here is how to read the actual response body and find the wrong Conversion ID, Label, or transaction_id causing it.
Can I fire a Google Ads conversion without the JS snippet - via image pixel or server-to-server call?
Yes, via an image pixel fallback or server-side tracking through the Ads API or a server GTM container. Here is which path fits which constraint, and how to verify each one landed.
Why does dynamic phone number swapping (call tracking) stop working after I move the script into GTM?
DNI scripts scan the DOM for phone numbers at the moment they execute. Here is why GTM's trigger timing changes that, and how to re-sync the scan with the actual render.
Facebook / Meta Pixel
Why does my Facebook Pixel purchase event fire twice, and how do I deduplicate it?
Double-firing usually comes from running both Pixel and Conversions API without a shared event_id. Here is exactly how Meta's deduplication field works and how to wire it on both sides.
Why does Facebook Pixel Helper report no pixel even though fbq() is loaded and firing?
fbq() calls queue silently even when the base pixel script never actually loaded. Here is how to check the real network requests Pixel Helper is looking for.
What's the right way to fire Facebook Pixel standard/custom fbq events from GTM instead of hardcoding them?
Hardcoded fbq calls in page templates drift out of sync with real page state. Here is the template-and-dataLayer pattern that keeps Pixel events accurate without a code deploy for every change.
Server-side GTM & custom templates
Why does my server-side GTM custom domain return a 404 instead of routing to the container?
A 404 means something in your DNS or load balancer chain is responding, just incorrectly. Here is how to trace the request through Cloud Run logs to find the real break point.
How do I fix CORS errors from my server-side GTM container running on Cloud Run?
CORS errors mean the browser's request to your server container is missing the right Access-Control-Allow-Origin header. Here is how to read the error and fix the origin mismatch or preflight handling.
How do I build a GTM custom template/variable to log events into a third-party SDK like Amplitude?
A raw Custom HTML tag works but has no field validation or permission declaration. Here is how to build a proper GTM custom template with the sandboxed JS APIs instead.
Not seeing your exact problem?
Tell us what GTM Preview and the Network tab are actually showing. We trace containers for a living and can usually place the cause fast.
Ask a GTM Engineer