Discrepancy JavaScript and Tag Manager tracker

Going from Google Analytics to Matomo, I installed Matomo Tag Manager on our site, but noticed very low page views (only 1/10th of what Google reports). Trying to find a cause, I created a new test site in Matomo and installed the JS tracker from that also on our site. And this tracker reports pageviews much closer to what Google reports!

Visiting my site with an uncommon browser (so that I can easily find my own visit), I can see in the Real-Time Log that the tag manager setup reports only a few of the pages I visit (only 3 out of 15 pages), while the JS tracker reports all. But at the same time, the JS tracker says I am reloading/revisiting several of the pages, which I am not, so it is actually over-reporting pageviews.

Also, both report me visiting some of the pages with “www” in front of the domain name, and some pages without. This is not true, all visits are done without “www”.

Both trackers are implemented right after eachother in the source of every page, with the JS tracker immediately following the MTM code.

Why is the Tag Manager not reporting all pageviews?

Hi @pbb72
Maybe you did not configure well the MTM tracker, or let some buggy code in it…? Also, I am not sure it is a good idea to track a same page with JavaScript (_paq) and MTM at the same time… (if I understand well)

  • How did you configure MTM, espacially the MTM configuration variable?
    image
  • Which bootstrap code?
  • What about errors in the browser console log? Network console?
  • Can you see all expected trackings in the network console when tracking with MTM?
  • Did you try to check tags execution with MTM preview mode?

Over the two months I have been able to fix the discrepancy between number reported in Google Analytics and Matomo (differences are now no more than ca 10-15 %). I am not sure anymore what I changed, or if it changed without me doing anything.

There are several factors that can influence statistics that are difficult to uncover. For example, Matomo filters out any “sid” parameter, which Google ignores.

Also, I’m still seeing a lot of switching between URLs with and without “www” during visits. While technically possible for users to edit the URL during their visit, I highly doubt this happens to the extend Matomo reports it.

Hi @pbb72

What do you mean as “sid”?

If, for example, the page at /page.html?test=1&sid=2&sidx=3&pid=4 is visited, then Matomo logs the address /page.html?test=1&sidx=3&pid=4. That is, all parameters except for “sid” are logged.

This is documented (for example on https://matomo.org/faq/media-analytics/faq_22412/), but not in a way that is easy to discover when you’re not specifically searching for it.

1 Like

Hi @pbb72
absolutely, this allows you to not distinguish the same page with just a session ID that is different. This helps the calculation of unique page visit count…

Going a bit off-topic here, but this shows a clear assumption that “sid” must ALWAYS mean “session id”.

It’s very dangerous to assume to know for certain what a three-letter acronym must stand for.

In my situation, sid was short for “system id”, a vital parameter, which Matomo, assuming to know better than me, removed from my statistics. One of several causes for discrepancy with Google Analytics, which retained the parameter.

Hi @pbb72

I think this has been done because PHP usually uses the sid in the URL, then this case is very common, and Matomo, in order to help most users (but not all), decided to not track this parameter by default.

Making things a little easier for most users, and a lot more difficult for some.

2 Likes