Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Deploy removed tracking snippet: how to find and fix it

OPS-293High impactDetectedBy FunnelGuardPublished Updated
On this page

What this issue is

A tracking snippet is a small piece of code, such as the Google Tag Manager container or a GA4 gtag.js tag, that sends visit and conversion data to analytics and ad platforms. It usually sits in the <head> of your pages.

A deploy is any release that changes your site: a code push, a theme update, a page builder republish or a template rewrite. If the snippet was pasted into a file that the deploy replaces, it is gone after the release. Nothing breaks on screen, so nobody sees it.

Why it costs you leads or sales

Without the snippet, form submissions and purchases still happen but are not recorded. Reports show a sudden drop that looks like a demand problem. Ad platforms such as Google Ads and Meta stop receiving conversions, so smart bidding and audiences learn from less data and may spend budget badly.

Where a release breaks tracking
  1. DeployTemplate file is overwritten
  2. SnippetTracking code no longer in the page
  3. Conversion hitNo request sent to GA4 or ad platform
  4. Ad optimisationPlatform has no conversion data

The visitor journey works, but the data stops at the page.

Recorded conversions before and after a deployExample numbers
Recorded conversions before and after a deploy (example)Real leads: 20 conversions per day; Recorded before deploy: 19 conversions per day; Recorded after deploy: 0 conversions per day081520190Real leadsRecorded before deployRecorded after deployconversions per day

Example: real leads stay steady, but recorded conversions fall to zero after the snippet is removed.

How to check if your site has it

Check for a missing snippet
  1. View the page source

    Open the live page, right-click, choose View page source and search for your container ID (for example GTM-) or measurement ID (G-).

  2. Watch the network requests

    Open browser developer tools, go to the Network tab, reload and filter for collect, gtm.js or facebook. No requests means no tag.

  3. Use a preview tool

    Use Tag Manager preview mode or GA4 DebugView to see whether the page connects and events arrive.

  4. Compare with your release date

    In GA4 or your ad platform, look for a sharp drop in events that starts on the day of a release.

  5. Check key pages, not just the home page

    Different templates can be affected differently, so test the landing page, form page and thank-you page.

A release removes the tag

The page loads normally, but no tracking request leaves the browser.

How to fix it

Restore the snippet, then move it to a place that releases do not overwrite. The right place depends on your platform.

Restore the snippet by platform
  1. Use a plugin or child theme

    Add the snippet with a header-scripts plugin or a Tag Manager plugin, or put it in a child theme's functions.php. Edits made directly in a parent theme are lost on theme updates.

  2. Clear caches

    Purge your caching plugin and CDN so the restored header is served.

Example: Google Tag Manager head snippet (replace GTM-XXXXXXX)html
<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;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXXXXX');</script>

How to confirm it's fixed

Confirmation checks
  • The container or measurement ID appears in the live page source.
  • Network tab shows requests to your analytics and ad platforms.
  • Tag Manager preview or GA4 DebugView shows the page view.
  • A test form submission or test purchase records a conversion event.
  • Landing, form and thank-you pages all carry the snippet.
  • Cached copies are cleared so visitors get the fixed page.

How to prevent it happening again

Where the snippet lives

Fragile

  • Pasted into a parent theme file
  • No check after releases
  • Found weeks later in reports

Protected

  • Stored in a child theme, site-wide settings or the shared layout in version control
  • A tracking check is part of every release
  • Alerts come within hours of a break
Release habits
  • Add a tracking check to your release checklist.
  • Keep the snippet in version control or site-wide settings.
  • Record every change in a changelog.
  • Test a conversion on a staging or live page right after deploying.
  • Avoid releasing right before peak ad spend.

How FunnelGuard handles this

FunnelGuard detects this today. A robot visitor runs your real customer journeys on a schedule and checks the tracking hits sent to GA4, Google Ads, Meta, TikTok, LinkedIn, Bing, Pinterest, Snapchat, X and Reddit. If a deploy removes the snippet, the expected hits stop appearing on that step and the check fails.

Questions people ask

Why did my conversions drop to zero after a deploy?

The release may have removed or overwritten the tracking snippet, so no conversion hits are sent. View the page source and search for your GTM or GA4 ID. If it is missing, restore it and test a conversion.

How do I check if my tracking code is still on my site?

Open the live page, view the source and search for your container or measurement ID. Then open the Network tab and look for requests to gtm.js, collect or your ad platform. No ID and no requests means the snippet is gone.

Why does my theme update remove my Google Analytics code?

If you pasted the code into a parent theme file, an update replaces that file and your edit disappears. Use a child theme, a header-scripts plugin or the platform's site-wide custom code setting instead.

How do I stop deploys from removing my tracking tags?

Keep the snippet in a shared layout under version control or in site-wide settings the release does not touch. Add a post-deploy check that confirms the tags fire on key pages.

Will lost tracking data come back after I fix it?

Usually not. Hits that were never sent cannot be recovered. Some ad platforms may have partial server-side data, but the gap in your reports normally stays. That is why fast detection matters.

Can FunnelGuard tell me when a deploy removes my tracking snippet?

Yes. FunnelGuard runs your journeys on a schedule and checks that tracking hits reach GA4 and the ad platforms. If they stop, it re-checks from a second region and sends one alert with a screenshot and a likely cause.

Do I need to check every page after a release?

Check the pages that matter for conversions: landing pages, form pages, checkout and thank-you pages. Different templates can be affected differently, so one working page does not prove the rest.

Does FunnelGuard catch this?

Detected

FunnelGuard checks for this today.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.