On this page
What this issue is
Google Tag Manager (GTM) lets you create environments, such as Live, Latest and a custom one like Staging. Each environment can serve a different version of the same container. To load a non-Live environment, GTM gives you a snippet whose script URL carries extra parameters: gtm_auth (an environment key) and gtm_preview (the environment ID).
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl+ '>m_auth=XXXXXXXX>m_preview=env-3>m_cookies_win=x';f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXXXXX');</script>Why it costs you leads or sales
The environment may hold a different set of tags from Live. Conversion tags added since the staging version was frozen will be missing. Test tags, or tags pointing at a test GA4 property or ad account, may run on real traffic. Your reports then show gaps or polluted data, and ad platforms optimise on poor signals.
- Visitor landsLive page loads the GTM snippet
- Staging environment servedgtm_auth and gtm_preview in the URL
- Conversion tagsMissing, outdated or sent to a test property
- Ad and analytics reportsGaps or polluted data
The live page loads the staging version, so later steps use the wrong tags.
Example: illustrative numbers only. Real leads stay the same, but recorded conversions drop when the staging version lacks the newest tags.
How to check if your site has it
View the page source
Open your live page, right-click, choose View page source, and search for
googletagmanager.com/gtm.js.Look for the extra parameters
If the URL contains
gtm_auth=orgtm_preview=, an environment snippet is live. A standard snippet only hasid=GTM-XXXXXXX.Check the Network tab
Open browser DevTools, go to Network, reload, and filter by
gtm.js. The request URL shows the parameters actually loaded, including ones added by a plugin or script.Compare with GTM
In GTM, open Admin, then Environments, and see which environment uses the key you found. Check which version it serves.
How to fix it
Get the correct snippet from GTM: open Admin, then Install Google Tag Manager. The default snippet there serves the Live environment. Then replace the staging one, wherever it was added.
Find where it is added
Check your GTM plugin settings (for example a Site Kit or GTM plugin), Appearance, Theme File Editor (header.php), or a header-and-footer scripts plugin.
Swap the code or ID
Replace the environment snippet with the standard one, or clear any environment fields the plugin offers. Clear your caching plugin afterwards.
Search the theme
Go to Online Store, Themes, Edit code, and search for
gtm_authin theme.liquid and snippets.Replace and save
Paste the standard snippet in place of the environment one. Also check Settings, Customer events, for any custom pixel with the same code.
Copy the live snippet
Open Admin, Install Google Tag Manager, and copy the default code.
Review environments
In Admin, Environments, use Get Snapshot Link only for staging sites. Keep those links out of production templates.
Check custom code
Open Project settings, Custom code, and look in Head code. Also check page-level custom code.
Replace and publish
Paste the standard snippet and publish to your live domain.
Check tracking code fields
Look in the funnel or website Settings, Tracking Code (header), and in each page's own settings.
Replace and save
Use the standard snippet, save and republish.
Check Custom Code
Go to Settings, Custom code (under Advanced), and look for the snippet. Also check Marketing integrations, Google Tag Manager.
Replace and publish
Update the code, then publish the site.
Check code injection
Open Settings, Developer tools, Code injection, and look in Header.
Replace and save
Paste the standard snippet and save.
Search the codebase
Run the search below across templates and config files.
Use environment variables
Store the GTM snippet or its parameters per environment, so staging values cannot reach a production build.
grep -rn "gtm_auth\|gtm_preview" --include="*.php" --include="*.html" --include="*.liquid" --include="*.js" .How to confirm it's fixed
- View source on the live page (after clearing caches) and confirm no
gtm_authorgtm_previewappears. - In DevTools Network, the
gtm.jsrequest has onlyid=GTM-XXXXXXX. - Open GTM Preview against the live URL and confirm the expected tags fire.
- Submit a test lead and check the conversion appears in GA4 DebugView or the ad platform's tag diagnostics.
- Check Realtime reports show data in the correct property.
How to prevent it happening again
- Keep staging and production snippets in separate config, never in a shared copied theme file.
- After cloning or pushing staging to live, search for
gtm_authas a release step. - Limit who can edit the header code on live.
- Name environments clearly and document which sites use which.
- Add a post-release check of the live page source to your deploy checklist.
How FunnelGuard handles this
FunnelGuard does not check for this yet. A check for gtm_auth in the page's GTM request is a possible future addition, but it does not exist today, so do not rely on FunnelGuard to tell you about it.
What FunnelGuard does cover nearby: it runs your real journeys on a schedule, such as lead forms and checkouts, and checks the tracking hits sent to GA4, Google Ads, Meta, TikTok, LinkedIn and others. If a staging version leaves out a conversion tag, that missing hit can show up in a journey check. That would point to a symptom, not name this cause.
Questions people ask
What does gtm_auth in my page source mean?
It means the page loads a Google Tag Manager environment snippet, not the default one. The gtm_auth value identifies a specific environment, such as staging, and gtm_preview names it. On a live site this usually means the wrong snippet was pasted.
Why is my live site loading the wrong GTM version?
Most often the staging environment snippet was copied into the live theme or template, or a staging site was cloned to production. Check the page source for gtm_auth and gtm_preview, then replace the snippet with the standard one from Admin, Install Google Tag Manager.
How do I find which GTM environment my site is using?
Open DevTools, go to the Network tab, reload and filter by gtm.js. If the request URL has gtm_preview=env-N, that environment is loaded. If it has only id=GTM-XXXXXXX, you are on the Live environment.
Is it bad to have a GTM staging snippet on a production site?
Yes. Visitors get the staging container version, which may lack recent conversion tags or send data to a test property. Your real traffic is then recorded poorly or in the wrong place.
How do I get the correct GTM snippet for my live site?
In Google Tag Manager, open Admin, then Install Google Tag Manager, and copy the two code blocks shown. The default snippet serves your Live environment. Place the first in the head and the second just after the opening body tag.
Does GTM Preview mode leave parameters on my site?
No. Preview mode loads a debug version only in your own browser session. Parameters you see for every visitor in the page source come from code on the site, not from Preview.
Can FunnelGuard tell me if a staging GTM snippet is live?
Not yet. FunnelGuard does not check for this today. It does check the tracking hits sent by your journeys, which can reveal missing conversions, but it won't name a staging snippet as the cause.
Related issues
- TRK-099GTM container snippet missingFix guide
- TRK-100Wrong GTM container ID on siteFix guide
- TRK-101Two GTM containers fighting (old agency + new)Fix guide
- TRK-102GTM container published version changed unexpectedlyFix guide
- TRK-103Workspace changes never published (tag in preview only)Fix guide
- TRK-116Tag firing in preview but blocked by consent settings in liveFix guide