What we think

Why doesn’t Google Analytics data match Google Tag Manager previewer when debugging?

What do you do when…You create a tag via Google Tag Manager, use the GTM previewer to debug it, GTM tells you “that’s working!” – but when you publish the new container and try to view the results of the tag, it just isn’t pulling in the right data or any data at all?

Seems unfair, doesn’t it?

I don’t know if this is a bug in GTM or if it will become “fixed,” but hopefully this post might give you some guidance about what to do.

Example – Fjellsport

This example comes from Christian at Fjellsport (the largest outdoor online store in Norway) which came about after trying to implement internal site search tracking.

Christian wanted to implement a tag for instances in which someone searched on Fjellesport, but their query returned no hits. He created a Google Analytics Event Tracking tag that fired on DOM Ready and returned either “hits” or “no hits”, depending on the search query result.

When he searched for a rubbish search query and ran GTM previewer, it showed that the tag had fired with the event category “no hits”, which was as expected.

Google Tag Manager Event Category

However, looking at Google Analytics, this search string (and other garbage strings) was pulling in as “hits”.

Google Analytics hits

Returning to the GTM Previewer, you can see on the left-hand side we are observing the “Summary” of the tags that have fired.

The left-hand display shows everything that has happened on-site (with regards to GTM) since the pageview began, with the most recent action at the top. You can see that it goes:

  1. Page View
  2. Message
  3. DOM Loaded
  4. Window Loaded
  5. click

In the case of this tag, it was supposed to load on “DOM Loaded” so I clicked “DOM Loaded” on the left-hand side to see what actually happened when the DOM loaded.

DOM loaded in Google Tag Manager

You can see that on “DOM Ready” the Action type is indeed “hits”, which is why Google Analytics is pulling this in.

I explored the next step after “DOM Loaded” which is “Window Loaded”, and if you switch to “Variables” and look at the variable called “EMMA – HitsNoHitsConfig” (which is the variable that we were using to create the Event Action), it says “No Hits”.

Window Loaded in Google Tag Manager

Now we have discovered what needs to be amended – the variable works, but it’s the trigger that’s incorrect.

Solution: Change the trigger from “DOM Ready” to “Window Loaded”

What if this happens to me?

Every case is different, but here are some things you can check:

  • Is your container published?
  • Is the tag paused?
  • Are the firing conditions correct?
  • If using GA, do you have a filter that may overwrite the data coming in?
  • Is there another tag that may interfere with this tag (for example, due to firing order)?
  • Is Google Tag Manager installed correctly?

If none of these things help solve your mystery, please feel free to get in touch.

Related posts