New

50% off Shop Products & 50% off 1st Month of Retainer Packages. Terms apply*. Contact us to apply your discount.

How to check for Google’s Service Workers in GTM server side tagging?

Last updated:

Home » Articles » Web Analytics » How to check for Google’s Service Workers in GTM server side tagging?

Google has introduced service workers in 2024-2025 for GTM to work with Server-Side Tagging, improving data collection and reliability. This innovation helps ensure that your website’s tracking data is captured more effectively, even when users have poor internet connections or quickly exit your pages.

What are service workers and why do they matter?

A service worker is a script that can intercept network requests, store data temporarily, and retry sending it later if the internet connection is lost. This represents a significant improvement over previous tracking methods.

Before service workers, GTM tags relied on methods like navigator.sendBeacon() to send tracking data directly to Google Analytics, Ads or other platforms. The problem with this approach was that some data could be lost if the user closed the page too quickly or lost internet connection. Additionally, navigator.sendBeacon() had limited browser support, particularly in older versions of Internet Explorer and Safari.

Service workers solve this problem by catching the tracking requests, storing them temporarily, and sending them later when the internet connection is back. This ensures more complete data collection, reducing the risk of missing events due to bad connectivity or fast exits.

When Google’s tracking scripts (gtag.js, GTM, GA, or Ads Scripts) detect that service workers are supported in the user’s browser, they automatically use this enhanced method to send data to server-side Tag Manager. In browsers where service workers aren’t available, the tracking continues to work using traditional methods.

How to check if a service worker is being used on your website

Initial Setup

  • Open a website that uses GTM Server-Side Tagging
  • Right-click anywhere on the page and select “Inspect” to open Chrome DevTools
  • Find and click on the “Application” tab

Basic Service Worker Check

  • Under ‘Service Workers’, check if any script is registered by looking at the source file
  • Look for common service worker names:
    • ‘sw.js’
    • ‘gtm-sw.js’
    • ‘gtag-sw.js’
    • ‘/_/service_worker/xyz/sw.js’ (uses dynamic naming by Google)
  • If a service worker is present → This confirms your Google Tag is using it to handle tracking data

Deeper Analysis Steps

  • Click the “Inspect” button next to the active service worker to open a dedicated debugging window
  • Navigate to the ‘Network’ tab to verify if the service worker is intercepting tracking requests

Network Request Verification

  • In the Filter bar, type “is:service-worker-initiated” to show requests initiated by a service worker
  • Click on a tracking request (such as collect?v=2)
  • Open the “Headers” tab
  • Look for ‘service-worker-allowed: /_/service_worker’ under the response header
  • If present → This confirms that GTM’s service worker is allowed and active

Optional Final Verification

  • Navigate to your SS tagging domain (e.g., sgtm.example.com)
  • Open the Console tab in DevTools
  • Run this command: navigator.serviceWorker.getRegistrations().then(console.log)
  • If the command returns an object beginning with “ServiceWorkerRegistration{installing:” → A service worker is registered and actively controlling the page

Important considerations for implementation

If your website has strict security rules, you may need to update your Content Security Policy (CSP) to allow service workers. This is an important step that shouldn’t be overlooked. According to Google’s official documentation from September 2024, “To ensure that the service worker loads correctly, consult the Content Security Policy guidelines.”

It’s also worth noting that Google hasn’t provided full details on how it uses service workers, so monitoring your network requests for any unexpected behaviour is good practice. The name of the service worker script in GTM isn’t fixed and depends on Google’s implementation.

Note: Service workers are supported in modern browsers including Chrome, Firefox, Edge, and recent versions of Safari. The feature automatically falls back to traditional tracking methods in browsers that don’t support service workers, ensuring your tracking continues to work across all browsers.

Implementation Timeline

Google first announced this feature in September 2024, stating “Google Tag Manager may use a service worker to improve performance and measurement reliability.” The feature was fully rolled out by March 2025, when Google confirmed: “Google tag now uses service workers, when available, to send data to server-side Tag Manager.”

This gradual rollout gave technical teams approximately six months to prepare for any necessary adjustments, particularly regarding Content Security Policies that might need modification.

Conclusion

Service workers represent an important advancement in how GTM collects and manages tracking data when working with server-side tagging configurations. By implementing this technology starting in late 2024, Google has made data collection more reliable, ensuring that important analytics information isn’t lost due to connectivity issues or user behaviour. For website owners concerned about data accuracy, this is a welcome improvement that helps provide more complete insights into user interactions. The technology works automatically in supported browsers, requires minimal setup in most cases, and gracefully falls back to traditional methods when needed.

If you need help with website tracking, book a call with Kahunam or visit our shop and pick one service that works for your case.

Become an expert website owner

Join our community of website professionals and learn how to achieve website success through our helpful newsletter.