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

[Bug] Matomo API segmentation on action Actions.getPageUrls gives inconsistent results and device type switches from upper case to lower case #22600

Open fabianboerner opened 3 days ago

fabianboerner commented 3 days ago

What happened?

We are calling

/?module=API&method=Actions.getPageUrls&idSite=1&format=JSON&date=2024-09-17,2024-09-18&period=day&segment=deviceType==Phablet

or

/?module=API&method=Actions.getPageUrls&idSite=1&format=JSON&date=2024-09-17,2024-09-18&period=day&segment=deviceType==phablet

One day we are getting results for phablet but none for Phablet and the next day we are getting results for Phablet but not for phablet

My post on the community forum:

https://forum.matomo.org/t/when-calling-the-api-with-smartphone-or-smartphone-in-segement-getting-different-results/59396/4

This happens for all devices and we cannot figure out what is happening here.

** EDIT

With the operator =^ starts With and "phablet", "smartphone" etc it seemed to be consistent first but then on some days i get the same results for =^phablet and for =^smartphone

It looks like the newest Data is not available with "phablet" but "Phablet"

The difference of nb_unique_visits is in those files: P_hablet.json phablet.json

With segement=deviceType=@smartphone i get more nb_uniq_visitors than without segmentation

What should happen?

  1. We should get the same data for "Phablet" or "phablet".

or

  1. One of those two should be considered an invalid parameter and throw an error

How can this be reproduced?

Import data to matomo and call the method Actions.getPageUrls with segmentation.

Matomo version

5.1.1

PHP version

PHP 8.2.21 (cli) (built: Jul 19 2024 10:33:10) (NTS)

Server operating system

Debian GNU/Linux 12 (bookworm)

What browsers are you seeing the problem on?

Not applicable (e.g. an API call etc.)

Computer operating system

No response

Relevant log output

No response

Validations

MatomoForumNotifications commented 2 days ago

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

https://forum.matomo.org/t/when-calling-the-api-with-smartphone-or-smartphone-in-segement-getting-different-results/59396/6

randy-innocraft commented 1 day ago

Hi @fabianboerner, thanks for reporting this issue. Unfortunately, we're unable to reproduce the problem. Are you able to provide any other info that may help us reproduce the issue?

fabianboerner commented 1 day ago

@randy-innocraft i dont know how, i only saw that some visits from desktop are causing some issues if i exclude them in the segmentation it looks almost alright.

The only thing i could provide is a database export. If there is a way to provide this in a secure environment maybe that would help?