matomo
matomo copied to clipboard
[Bug] Inconsistent datatypes from `Events.getAction`
What happened?
We have a self-hosted Matomo that we try to keep up-to-date as much as possible. Our data is being imported into datawarehouse (and subsequently into PowerBI), and this includes event data, that are requested from the Event.getAction
API endpoint. Our developer notices inconsistencies in the datatypes. Here is an example of what I mean:
[{
"label": "xxx",
"nb_uniq_visitors": 65,
"nb_visits": 65,
"nb_events": 86,
"nb_events_with_value": 0,
"sum_event_value": 0,
"min_event_value": 0,
"max_event_value": 0,
"avg_event_value": 0,
"segment": "eventAction==xxx"
},
{
"label": "xxx",
"nb_uniq_visitors": 3,
"nb_visits": "3", <- String instead of int
"nb_events": "4", <- String instead of int
"nb_events_with_value": "0", <- String instead of int
"sum_event_value": 0,
"min_event_value": 0,
"max_event_value": 0,
"avg_event_value": 0,
"segment": "eventAction==xxx"
}]
Another example, with some more details. I suspected that this had to do with the major version update from Matomo 4 to 5 that we did at the beginning of the year. Here is a response from the API retrieved in september 2023:
[
{
"label": "xxx",
"nb_uniq_visitors": 3,
"nb_visits": 3,
"nb_events": 9,
"nb_events_with_value": 0,
"sum_event_value": 0,
"min_event_value": false,
"max_event_value": 0,
"avg_event_value": 0,
"segment": "eventAction==xxx"
},
{
"label": "xxx",
"nb_uniq_visitors": 3,
"nb_visits": 3,
"nb_events": 7,
"nb_events_with_value": 0,
"sum_event_value": 0,
"min_event_value": false,
"max_event_value": 0,
"avg_event_value": 0,
"segment": "eventAction==xxx"
}
]
As you can see, this has integer values. Same API, same website, but in february 2024:
[
{
"label": "methodStarted",
"nb_uniq_visitors": 5,
"nb_visits": "5", <!---
"nb_events": "10", <!---
"nb_events_with_value": "0", <!---
"sum_event_value": 0,
"min_event_value": 0,
"max_event_value": 0,
"avg_event_value": 0,
"segment": "eventAction==methodStarted"
},
{
"label": "situationStarted",
"nb_uniq_visitors": 5,
"nb_visits": "5",
"nb_events": "6",
"nb_events_with_value": "0",
"sum_event_value": 0,
"min_event_value": 0,
"max_event_value": 0,
"avg_event_value": 0,
"segment": "eventAction==situationStarted"
}
]
Strings instead of integers.
Is this due to the new version? We were unable to find mention of this in the release notes. I also searched the issues here, and the forum, but found no mention of this issue. Any ideas?
Please note that we are always on a recent version of Matomo, i.e. at the moment that is 5.0.2. I don't know exactly which version it was in september 2023, but I suspect that it must have been 4.15.1.
What should happen?
One would expect the datatypes to be consistent, and most of all that nb_
values would actually contain an numeric value, instead of a string.
How can this be reproduced?
I am not sure exactly, but I would suspect requesting the mentioned data from the API in the versions mentioned would produce results like these.
Matomo version
5.0.2
PHP version
8.1.27
Server operating system
Debian 11
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
- [X] Read our Contributing Guidelines.
- [X] Follow our Security Policy.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating duplicates.
- [X] The provided steps to reproduce is a minimal reproducible of the Bug.