matomo-org / matomo

Empowering People Ethically with the leading open source alternative to Google Analytics that gives you full control over your data. Matomo lets you easily collect data from websites & apps and visualise this data and extract insights. Privacy is built-in. Liberating Web Analytics. Star us on Github? +1. And we love Pull Requests!
https://matomo.org/
GNU General Public License v3.0
19.71k stars 2.62k forks source link

Discrepancy in visit metrics across Matomo reports #21289

Open heurteph-ei opened 1 year ago

heurteph-ei commented 1 year ago

Context

From: https://forum.matomo.org/t/discrepancy-in-visit-metrics-across-matomo-reports/53254

Expected Behavior

Each reports should display the same number of (unique) visitors (for the same day)...

Current Behavior

It doesn't: https://demo.matomo.cloud/index.php?module=CoreHome&action=index&idSite=1&period=day&date=2023-09-19#?idSite=1&period=day&date=2023-09-19&category=Referrers_Referrers&subcategory=Referrers_WidgetGetAll image https://demo.matomo.cloud/index.php?module=CoreHome&action=index&idSite=1&period=day&date=2023-09-19#?idSite=1&period=day&date=2023-09-19&category=General_Visitors&subcategory=UserCountry_SubmenuLocations image https://demo.matomo.cloud/index.php?module=CoreHome&action=index&idSite=1&period=day&date=2023-09-19#?idSite=1&period=day&date=2023-09-19&category=General_Visitors&subcategory=DevicesDetection_Devices image image

Possible Solution

Unknown

Steps to Reproduce (for Bugs)

See Current behavior.

Your Environment

Matomo Demo Cloud...

MatomoForumNotifications commented 1 year ago

This issue has been mentioned on Matomo forums. There might be relevant details there:

https://forum.matomo.org/t/discrepancy-in-visit-metrics-across-matomo-reports/53254/4

LenaGadea commented 1 year ago

A bit more information on the issue in case it might be of relevance:

sgiehl commented 1 year ago

@LenaGadea Is the site where that happens a site that is tracked or is it a roll up aggregating other sites?

LenaGadea commented 1 year ago

@sgiehl It is a site being tracked. We are tracking a few other sites (with less custom dimensions etc) with no problem. There was as well a roll up aggregating those other websites that started to have great delay on the data as well so we have removed it for now, but the data inconsistency on this site's reports remain.

Stan-vw commented 1 year ago

That's quite a few different numbers across different places.

@sgiehl Are all places using the same query to calculate this metric?

LenaGadea commented 1 year ago

@Stan-vw it is, indeed. Also, the reports were perfectly fine and consistent for months before suddendly going crazy. No changes in any configuration. During that week we created a few custom reports and activated SEO Web Vitals plugIn. We deactivated the plugin right away, and also eliminated all the reports recently.

sgiehl commented 11 months ago

@Stan-vw The queries should be similar in most cases, but group by different dimensions. This actually should only affect unique visitors, as they are sort of handled special. I haven't check that in detail yet, but my assumption is, that this is kind of expected.

Assuming the following visits

visit id visitor id browser operating system
1 A Firefox Linux
2 B Firefox Windows
3 A Chrome Linux

So we have one visitor, that came back with different device, but was still recognized as the same visitor.

If you now built unique visitors metrics for those visits you get:

Over all unique visitors: 2

browser unique visitors
Firefox 2
Chrome 1
Totals 3
operating system unique visitors
Linux 1
Windows 1
Totals 2

From a dimension point a view those numbers would be correct, as there were two different (unique) visitors using Firefox and one using Chrome.

@LenaGadea Did you maybe start using the user id feature or another method that identifies users across devices?

LenaGadea commented 11 months ago

No changes were made in the tracking method. The correct data was available in the database, it was just the dashboards that that started to track very slowly and showing different metrics. Since we eliminated the custom reports (there were 5-6, nothing too crazy) the numbers are back to normal, all the reports are consistent and look fine. Is maybe some sort of performance problem linked to the custom reports? As suddenly as it started failing it recovered, and the only changes made have been: eliminating the reports and adding a new MySQL read-only node.

Stan-vw commented 11 months ago

That's interesting, thanks for writing this up and great to hear that the problem is not present anymore. Could you perhaps elaborate what specific reports were in your custom reports, so we can look at those specifically rather than trying the find the issue across all custom report queries?