Skip to content
FunnelGuard

Fix guide by FunnelsGuard

WordPress plugin update removed tracking snippet: how to fix it

TRK-397High impactDetectedBy FunnelGuardPublished Updated
On this page

What this issue is

Many WordPress sites load tracking through a plugin: an analytics plugin, a tag manager plugin, a Meta pixel plugin, a theme option, or a plugin that injects code into the header and footer. When that plugin updates, the new version can behave differently from the old one.

Common ways the snippet disappears: the update resets or migrates settings and loses your ID, the plugin moves the snippet to a new hook that your theme does not call, a new consent or privacy option defaults to blocking scripts, the plugin is deactivated after a failed update, or a caching or optimisation plugin keeps serving the old HTML or delays and strips the script.

Why it costs you leads or sales

Without the snippet, GA4 records no sessions, and ad platforms receive no conversions. Smart bidding in Google Ads and Meta optimises on conversion data, so it starts working from stale or empty signals. Retargeting audiences stop filling. Reports show a drop that looks like a traffic problem when it is a measurement problem.

How one plugin update breaks measurement
  1. Plugin auto-updatesNew version changes settings or hooks
  2. Snippet removedTag ID no longer printed in the page
  3. Page views not sentGA4 and ad pixels stay silent
  4. Conversions not sentLeads and purchases not attributed
  5. Ad bidding starvesPlatforms optimise on missing data

The visitor journey still works, but every step after the update is unmeasured.

Reported conversions around a plugin updateExample numbers
Reported conversions around a plugin update (example)Day before update: 24 conversions per day; Day of update: 12 conversions per day; Day after: 0 conversions per day; Three days after: 0 conversions per day0918241200Day before updateDay of updateDay afterThree days afterconversions per day

Example: illustrative numbers. Real leads keep arriving, but reported conversions drop to zero after the update.

How to check if your site has it

Check for a missing snippet in about five minutes
  1. Check what updatedWordPress

    In WordPress go to Dashboard > Updates, or Plugins > Installed Plugins, and look at which tracking, header, cache or consent plugins changed recently. Many hosts also keep an update log.

  2. View the page source

    Open your homepage in a private window, right-click and choose View page source, then search (Ctrl+F or Cmd+F) for your tag ID, such as G-XXXXXXX, GTM-XXXXXXX or the Meta pixel ID. Do this on a key landing page too.

  3. Use a tag debugger

    Use Google Tag Assistant for GTM and GA4, or the Meta Pixel Helper browser extension. Check that the tag loads and fires on page view.

  4. Check the network tab

    In browser DevTools open Network, reload, and filter for collect, gtm.js, gtag or fbevents. No request means the tag is not running.

  5. Compare reports

    In GA4 open Reports > Realtime while you browse your site. If your visit does not appear, tracking is off. Also look for a sudden drop starting on the update date.

  6. Rule out consent and caching

    Test with consent accepted. Purge your cache and test again, to see whether the snippet is missing or only blocked or stale.

Quick console check for common tags (run in DevTools Console)javascript
console.log({
  gtm: !!(window.google_tag_manager),
  gtag: typeof window.gtag === 'function',
  dataLayer: Array.isArray(window.dataLayer) ? window.dataLayer.length : 0,
  metaPixel: typeof window.fbq === 'function'
});

How to fix it

The fix depends on how the snippet was installed. First find out which plugin was responsible, then restore the snippet in a way that survives updates.

Restore tracking
  1. Identify the plugin that printed the snippetWordPress

    Check the plugins that changed. Open each one's settings and look for an empty tracking ID, a disabled toggle or a new 'load scripts' option.

  2. Re-enter the ID and saveWordPress

    Paste your GA4 measurement ID, GTM container ID or pixel ID back into the plugin and save. Check any new options for placement (header or footer) and for consent behaviour.

  3. Reactivate or roll back if neededWordPress

    If the plugin was deactivated, reactivate it and read the error. If the new version is broken, roll back to the previous version (a rollback plugin or your host's backup) and report the bug to the plugin author.

  4. Purge every cache

    Clear the page cache, the optimisation plugin's cache (including minified and combined JavaScript), your host cache and any CDN cache. Also exclude your tag script from delay or defer options if it stopped firing.

  5. Check the theme still calls the hooksWordPress

    Plugins that print code rely on wp_head and wp_footer. If you changed or updated the theme, confirm header.php calls wp_head() and footer.php calls wp_footer().

  6. Re-test a real conversion

    Submit a test lead or run a test order and confirm the event arrives in GA4 DebugView, Tag Assistant or Meta Events Manager Test Events.

Where to put the snippet so updates do not remove it
  1. Use one place for tracking

    Pick a single method, for example one tag manager plugin or one header-scripts plugin, and do not duplicate the tag in the theme or other plugins. Duplicates cause double counting after a partial restore.

  2. Prefer a small must-use plugin for critical tags

    A custom plugin or code in a child theme is not touched by tracking plugin updates. See the code example below.

Child theme: print the GTM container in the headphp
<?php
// functions.php of a child theme
add_action( 'wp_head', function () {
    if ( is_admin() ) { return; }
    ?>
<!-- Google Tag Manager -->
<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>
<!-- End Google Tag Manager -->
    <?php
}, 1 );
Tracking before and after the fix

After the update

  • No tag ID in the page source
  • GA4 Realtime shows nothing
  • Ad platforms report zero conversions
  • Nobody was told

Fixed

  • Tag ID present in the head of every page
  • Realtime shows your test visit
  • Test lead appears as a conversion
  • Snippet kept in one update-safe place

How to confirm it's fixed

Confirmation checklist
  • View source on the homepage and a landing page shows your tag IDs once each
  • Tag Assistant or Pixel Helper shows the tags firing on page view
  • GA4 Realtime or DebugView shows your visit
  • A test form submit or test order reaches GA4 and each ad platform
  • Google Ads and Meta show the conversion as recent, allowing for their reporting delay
  • Test with a logged-out private window and with consent accepted
  • Caches have been purged and the page still shows the tag

How to prevent it happening again

Prevention habits
  • Update plugins on a staging copy first, and test a conversion before you push live
  • Turn off auto-updates for the plugin that prints your tracking, or review its changelog before updating
  • Keep tracking in one place, ideally a single GTM container
  • Take a backup or snapshot before updates so you can roll back
  • Keep a note of your tag IDs outside WordPress so you can re-enter them quickly
  • Add a post-update check: view source for tag IDs and fire one test conversion
  • Set up an automatic check that runs after hours, so a silent change is caught within a day
How it usually plays out without monitoring
  1. Day 0

    Auto-update runs overnight and the plugin loses its tracking setting.

  2. Day 1

    Reports dip, but it looks like a quiet day.

  3. Day 4

    Ad platforms warn about low conversion data, or a client asks why numbers fell.

  4. Day 5

    You find the missing snippet and restore it. Days of data are gone for good.

How FunnelGuard handles this

FunnelGuard detects this issue today. A robot visitor runs your real customer journeys on a schedule, and on each step it checks the tracking hits sent to GA4, Google Ads, Meta, TikTok, LinkedIn, Bing, Pinterest, Snapchat, X and Reddit. If a tag that used to fire stops firing after an update, the check fails.

Questions people ask

Why did my Google Analytics stop tracking after a WordPress plugin update?

The update most likely reset the plugin's settings, changed where it prints the snippet, or left the plugin deactivated. A cache can also keep serving old HTML. View the page source and search for your G- or GTM- ID to see whether the code is missing or just not firing.

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

Open a page in a private window, view the page source and search for your tag ID. Then confirm it fires with Google Tag Assistant or Meta Pixel Helper, and check GA4 Realtime while you browse.

Why is my Meta Pixel not firing after updating WordPress?

The pixel plugin may have lost its pixel ID, moved its script, or been blocked by a new consent setting or a script-delay option in an optimisation plugin. Re-enter the ID, clear caches, then test with Pixel Helper and Events Manager Test Events.

How do I stop WordPress updates from removing my tracking code?

Keep the snippet in one update-safe place, such as a GTM container added through a child theme or a dedicated header-scripts plugin. Test updates on staging, take backups, and run a conversion test after each update.

Can a caching plugin make my tracking code disappear?

Yes. A cache can serve an old version of the page, and optimisation settings that minify, combine, delay or defer JavaScript can stop a tag from loading. Purge all caches and exclude your tracking script from delay options if needed.

Will I get back the data I lost while tracking was off?

Usually not. GA4 and ad platforms only record what the snippet sends at the time, so the gap stays. Fix it quickly and annotate the gap in your reports so it is not misread.

How can I be alerted when a plugin update breaks tracking?

Use a synthetic monitor that runs your journeys on a schedule and checks that tracking hits are sent. FunnelGuard does this and, when it detects a WordPress plugin as the likely cause, includes that in the alert.

Does FunnelGuard catch this?

Detected

FunnelGuard checks for this today.

How: root-cause WP plugin fingerprint.

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.