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.68k stars 2.62k forks source link

Fix calculation of action custom dimension metrics #22571

Open sgiehl opened 1 week ago

sgiehl commented 1 week ago

Description:

The calculation of some metrics for action custom dimensions was not correct.

We used to fetch all metrics grouped by custom dimension value and url to be able to directly fill the subtable reports. The main report was then created by aggregating the subtable values.

This results in incorrect numbers, as e.g. metrics like nb_visits or nb_uniq_visitors can't be simply summed up. They need to be fetched separately from the database.

This PR changes the archiving, so it uses two queries. One to fetch the metrics for the main report (grouped by custom dimension value only) and another query to fetch the data for subtable reports (grouped by custom dimension value and url).

fixes #19164

Review