GTMSpy doesn't support GA4 (Google Analytics 4) tags, but in some cases it can still be used to get insights on whether a site uses GA4. Here's how.
GTMSpy (https://gtmspy.com) is a great free tool for 'spying' on any Google Tag Manager container. It lets you see the contents of, and export, the container even if you haven't been granted access to the container or GTM account.
But it has one big limitation - it doesn't support Google Analytics 4 tags. GA4 Event tags and Configuration tags just don't show up at all when you spy on a container that contains them. And it looks like its creator, Dustin Recko, has no immediate plans to fix this.
Does that mean GTMSpy is useless for getting intel on whether a site uses GA4? Not necessarily, but it depends on how GA4 has been implemented within GTM for that site.
Every site using GA4 has a so-called Measurement ID, with the format G-XXXXXXXXXX. This Measurement ID is added to the GA4 Configuration tag - but there are at least three ways to do that. And two of them do leave evidence in GTMSpy.
The first way to implement GA4 in GTM is by creating a 'Constant' variable with the Measurement ID as its Value, then using this variable in the GA4 Configuration tag. This is actually the approach I take on this site. So here is my Constant variable:
And here is my GA4 Configuration tag making use of that variable:
The benefit of this approach is that if I reference the Measurement ID in more than one place, I can update all those references at once just by updating the variable.
And variables (unlike GA4 tags) do show up in GTMSpy, so if you 'spy' on my site you would be able to see my Constant variable like so:
This tells you:
Better than nothing, right?
The second way to implement GA4 in GTM is by using a Lookup Table variable to specify the Measurement ID. This is often the case when a single GTM container is used on multiple websites. Of course, it only makes sense to do that if all the sites have very similar tracking requirements.
With this approach, the lookup table has each site's page hostname as the input, and the Measurement ID as the output. The table also has an optional default value, also likely to be a Measurement ID.
I've taken this approach myself with a client but I can't share that as an example, so here's a quick mockup for you instead:
Then this Lookup Table variable is used in the GA4 Configuration tag:
Again, the GA4 Configuration tag won't show up in GTMSpy but the Lookup Table variable will. The tool shows you the default value for the variable:
And click on [LIST] to see the entire table (hostnames and corresponding Measurement IDs) in an overlay:
This tells you:
The third way to implement GA4 in GTM, and sadly I suspect the most common, is by adding the Measurement ID directly into the GA4 Configuration tag like this:
I say 'most common' because it's the approach that GTM advises you to take in the little tooltip next to 'Measurement ID'. This says: "Enter the Measurement ID (e.g, G-A2ABC2ABCD) for your GA4 property."
And I say 'sadly' because it means there's nothing for GTMSpy to spy. It won't see the Configuration tag, and with this approach there are no GA4-related variables for it to report on instead.
This means that if GTMSpy draws a blank, a site may or may not be using GA4. Remember that absence of proof is not proof of absence! You will just have to continue your investigation some another way.
If you go to the console in your browser and enter
it will give you the site's GA4 Measurement ID, GTM Container ID, and Google Optimize ID even if the Measurement ID was directly added in the Configuration tag.
Thanks, Brett - a handy tip and one I've used myself multiple times since you left this comment!