GTM Coverage Tool
An Electron app that crawls a website and generates a CSV of all URLs to upload into Google Tag Manager's Tag Coverage feature.
Google Tag Manager has a fairly new feature called Tag Coverage. Whether it’s actually useful in its current state is up for debate. But for me that was a good enough excuse to do a little Electron project again. So what is the Tag Coverage feature in Google Tag Manager?
Google Tag Manager – Tag Coverage feature
“Tag Coverage” is supposed to give you visibility into which pages have the Google tag (gtag.js) installed.
At the moment the accuracy seems pretty rough. The automatically generated list misses many URLs, and the detected tag status (e.g. “Not tagged”) seems wrong in many cases.
That said, the idea behind the Tag Coverage feature is reasonable. Having an overview of whether certain parts of a website are no longer covered by your tracking is genuinely useful.
Besides the automatic URL discovery there is also the option to upload a custom list of URLs. Because the automatic detection takes a long time, uploading your own file seems much more sensible. That’s where the GTM Coverage Tool comes in.
The GTM Tag Coverage Tool is an Electron app that runs locally on your machine to quickly generate a CSV of all available URLs of a website. Under the hood it uses the browser automation library Crawlee, which provides the PlayWright crawler that I’m using.
How do I use the app?
Currently I only build releases for macOS and Windows. The plan is to fully open source the app later, so that custom builds can be created with Electron Forge too.
Installation
The ZIP archives just need to be unpacked. The required dependencies, e.g. Chromium, are bundled. That’s also why the ZIP archive is around 350 MB.
Download Releases
(Optional) Download the Tag Coverage file
In the Google Tag Manager account you can download the current Tag Coverage CSV. It serves as a template for the app and gets enriched with additional URLs during the process.
Google Tag Manager — Tag Coverage
The structure of the downloaded CSV looks like this and contains, besides a header, the URLs that have already been detected for the property. In most cases the list is far from complete.
Google Tag Manager — Tag Coverage CSV file
Crawl a website
Once the app is open, either open the CSV file or use “use blank draft” and provide the URL of the website to crawl.
GTM Tag Coverage — Interface
While the crawl is running you can monitor the current number of crawled URLs at the bottom. Once all available URLs of the website have been processed, the save dialog opens automatically and you can upload the resulting file in Google Tag Manager.
If you track multiple websites / domains in your GTM, you can use the generated file directly as a template for another crawl. That way you can combine and extend the data of multiple websites.
Notes
App tracking
My tool is tracked via the Measurement Protocol for GA4 and collects anonymous usage data. For example, the number of requests or the runtime of the crawler is sent. Personal data such as the crawled URLs is not tracked. The exception is the hardware ID, which is used to distinguish and count users.
Google Analytics 4 — example app events
Identifying crawler traffic
The crawler always uses the same User-Agent, which can easily be queried via window.navigator.userAgent.
//Recommended: exclude this traffic via GTM
"Mozilla/5.0 (compatible; GTM-Tag-Coverage/0.1; +http://www.moritzbauer.info)"
This makes it easy to exclude the traffic via Google Tag Manager, or to mark it so that filters can be used inside Google Analytics.