On this page
What this issue is
A service worker is a JavaScript file that a browser installs for your site. It sits between the page and the network and can reply to requests from a local cache. It is used by progressive web apps (PWAs), some headless builds and some WordPress or Shopify caching and offline plugins.
The problem starts when the worker caches your HTML pages. Those pages contain your tracking snippets, such as the GA4 or Google Tag Manager (GTM) code, the Meta pixel or a conversion event. If you change or fix the snippet on the server, returning visitors can still be served the saved page with the old code.
Why it costs you leads or sales
Conversions fire from the page the visitor actually sees. If that page is a stale copy, you can lose page views, form submits or purchases for the people who see it, while new visitors look fine. The gap is hard to spot because the numbers drop only for repeat visitors.
Ad platforms then get fewer conversion signals from your best audience: returning visitors who are close to buying. Reports show a quiet dip after a release, and the team may blame the change that was meant to fix tracking.
- You fix the tagNew snippet is live on the server
- Service worker answersServes cached HTML from last visit
- Old tags runWrong ID or no snippet
- Conversion reportedNever reaches GA4 or ad platform
You deploy new tags, but returning visitors still get the saved page.
Example: new visitors record the fix straight away, while returning visitors on a stale cache still miss conversions.
How to check if your site has it
Look for a registered worker
In Chrome, open DevTools, go to Application, then Service workers. If a script is listed for your domain, the site uses one.
Inspect the cache
Under Application, open Cache storage. Open each cache and look for HTML URLs such as your home page or landing pages.
Compare cached and live HTML
Click a cached HTML entry and check its Response tab for your tracking snippet and IDs. Compare it with View Source on a private window.
Test as a returning visitor
Load the page, deploy a visible change, then reload in the same normal window. If you still see the old version, the worker is serving a stale copy.
Check what the Network tab says
Reload with the Network tab open. A request marked 'from ServiceWorker' in the Size column was not fetched fresh.
How to fix it
The goal is that HTML always comes from the network when online, the cache name changes with each release, and the new worker takes over quickly. Which file you edit depends on how the worker is built.
Use network-first for HTML
In your service worker's fetch handler, send navigation requests to the network first and fall back to the cache only when offline. See the snippet below.
Version the cache
Change the cache name each release and delete older caches in the activate event.
Activate the new worker
Call self.skipWaiting() on install and clients.claim() on activate so open tabs stop using the old worker.
Serve the worker file uncached
Send Cache-Control: no-cache for the service worker file itself so browsers check for updates.
Find the source
Service workers usually come from a PWA, offline or performance plugin. Check the plugin's settings for offline or caching options.
Exclude HTML
Switch pages to network-first, or turn off page caching in the worker, if the plugin offers it. Otherwise disable the feature.
Purge and update
Clear the plugin's cache after changing settings so a new worker version is published.
Find the source
Standard Shopify themes do not add a caching worker. Check installed apps and the theme code for a registered service worker.
Change or remove it
Adjust the app's offline or PWA setting, or remove the app. Ask the app's support if there is no setting for HTML caching.
Check custom code
Webflow does not add a service worker on its own. Look in Project settings, Custom code, and in page-level code for a navigator.serviceWorker.register call.
Remove or update
Remove the registration, or update the worker file it points to with the network-first approach, then publish the site.
Check for tags that register a worker
Look in your container for Custom HTML tags that call navigator.serviceWorker.register and review what they cache.
Publish and test
Use Preview mode in a normal window that has visited before. Publish only after the stale cache is ruled out.
const CACHE = 'site-v2'; // change on every release
self.addEventListener('install', () => self.skipWaiting());
self.addEventListener('activate', (event) => {
event.waitUntil(
caches.keys()
.then((keys) => Promise.all(
keys.filter((k) => k !== CACHE).map((k) => caches.delete(k))
))
.then(() => self.clients.claim())
);
});
self.addEventListener('fetch', (event) => {
if (event.request.mode === 'navigate') {
event.respondWith(
fetch(event.request).catch(() => caches.match(event.request))
);
}
});self.addEventListener('install', () => self.skipWaiting());
self.addEventListener('activate', (event) => {
event.waitUntil(
caches.keys()
.then((keys) => Promise.all(keys.map((k) => caches.delete(k))))
.then(() => self.registration.unregister())
);
});How to confirm it's fixed
Visit with the old worker
Use a normal browser profile that loaded the site before the fix.
Reload twice
The first load fetches the new worker. After the second, check Application, Service workers, and confirm the new script is active.
Check the cache
Confirm old cache names are gone and cached HTML, if any, contains the right snippet.
Fire a test conversion
Complete a test form or action and confirm the event in GA4 DebugView or your ad platform's test tool.
Before
- HTML saved in a fixed cache name
- Returning visitors get the old page
- Old or missing tags run
After
- HTML fetched from the network first
- Cache name changes each release
- New worker active on next visit
How to prevent it happening again
- Never cache HTML cache-first; use network-first or stale-while-revalidate with care.
- Change the cache version on every deploy that touches tags.
- Serve the service worker file with Cache-Control: no-cache.
- Delete old caches in the activate event.
- After a tracking change, test in a normal profile that visited before.
- Keep a note of which plugin or build step generates the worker.
How FunnelGuard handles this
FunnelGuard does not check for this yet. It is a possible future check. A stale service worker cache lives in each returning visitor's browser, and FunnelGuard's robot visitor normally arrives fresh.
What FunnelGuard does check nearby: it runs your real customer journeys on a schedule, and confirms the tracking hits sent to GA4, Google Ads, Meta and other platforms, and that test leads reach your inbox and CRM. If a bad cache or release leaves tags missing on a fresh visit, a failing journey can show it, with a screenshot and a likely cause.
To watch for the stale cache yourself, add the checks above to your release routine and compare daily conversion counts for returning and new users in GA4 after each deploy. A free FunnelGuard plan (1 site, 2 journeys, daily checks) can cover the basics of your key journeys.
Questions people ask
Why are my tracking tags not updating after I changed them?
A service worker may be serving a saved copy of your page to returning visitors. Open DevTools, then Application, then Service workers and Cache storage to see if one exists. If cached HTML has the old snippet, switch HTML to network-first and publish a new worker version.
Can a service worker cache Google Tag Manager?
Yes, if the worker caches HTML or script requests. A cached page can point to an old container or have no snippet. Changes published inside GTM usually still load, because the container script is fetched separately, unless the worker also caches it.
How do I clear a service worker cache?
In Chrome, open DevTools, go to Application, then Storage, and click Clear site data, or unregister the worker under Service workers. This only fixes your browser. For visitors, ship a new worker that deletes old caches in its activate event.
How do I force a new service worker to take over?
Call self.skipWaiting() in the install event and clients.claim() in the activate event. Also change the cache name on each release and serve the worker file with Cache-Control: no-cache so browsers look for updates.
Should a service worker cache HTML pages?
Usually not cache-first for pages that hold tracking code. Use network-first, falling back to the cache only when the visitor is offline. That keeps tags current while still giving a basic offline page.
How do I remove a service worker I no longer need?
Do not just delete the file or the registration code, because browsers keep the installed worker. Serve a replacement worker that deletes its caches and calls registration.unregister(), and keep it live for some time.
Does FunnelGuard detect a stale service worker cache?
No, not yet. It is a possible future check. FunnelGuard does run your real journeys on a schedule and checks tracking hits, so missing tags on a fresh visit can show up as a failing journey.
Related issues
- TRK-397WordPress plugin update removed tracking snippetFix guide
- TRK-398Page builder (Elementor/Webflow) custom code not publishedFix guide
- TRK-389SPA route change sends no page_viewFix guide
- TRK-391Next.js/React hydration error stops tagsFix guide
- TRK-400Tracking only in site header, funnel pages use blank templateFix guide
- TRK-390SPA sends page_view twice per routeFix guide