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:

We're running a competition. Giving away a free SEO backlinks bundle to a lucky email subscriber in October.

*Terms and conditions apply.

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

Google has introduced service workers for GTM Server Side Tagging to improve 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.

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.

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.

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.

Conclusion

Service workers represent an important advancement in how GTM collects and manages tracking data. By implementing this technology, 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.

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.

We'll assist you in building a website that works through our exclusive newsletter

Kahunam values everyone who visits us. We have been secretly working behind the scenes to create useful resources like checklists, security guides, helpful tools and plugins, and exclusive deals and freebies to help visitors. All of this becomes yours when you subscribe (because the best stuff should go to the people who stick around).

Book a Discovery Call