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.91k stars 2.65k forks source link

Which parameters can `uadata` receive using the Tracking HTTP API? #20128

Open donni106 opened 1 year ago

donni106 commented 1 year ago

In order to transmit several specific values from mobile devices like brand, os, type, ... it seems to be legit to use uadata. There is an issue started at https://github.com/donni106/matomo-tracker-react-native/issues/13 about that topic, where values are undefined and presented as unknown in Matomo.

Is there a way to enrich the data per uadata or what are the correct params to use?

image https://developer.matomo.org/api-reference/tracking-api#optional-user-info

sgiehl commented 1 year ago

Hi @donni106. Thanks for creating the issue. Guess we could improve the documentation around that. The javascript tracker code to gather the data is located here: https://github.com/matomo-org/matomo/blob/2c63f2726077b57275ee0d74a1f0c9ac2a147529/js/piwik.js#L3070-L3088 The values send with uadata then are checked with device detector. So it's not possible to send through random values, as they might get ignored then.

angelxmoreno commented 1 year ago

@sgiehl are you saying that when using Matomo to track mobile apps, there is no way to override device model? How does the matomo-sdk-ios handle this then? Is the solution sending a custom user-agent that is structured in a way that Matomo's device detector can consume?

sgiehl commented 1 year ago

Yes a custom value is not possible at the moment. Haven't looked at the sdks lately, but I think they were sending though custom useragents that allowed detecting the device.

angelxmoreno commented 1 year ago

Awesome. Thank you for the clarification. For a bit of context: we are using the http api with ReactNative but are unable to use the IOS SDK due to compatibility. We can gather information about the user device but do not know how to populate it on Matomo.

Seems to me like the solution is to use a user agent value that best matches the device info. Where could we learn more about

Where could we learn more about how Matomo breaks down the user agent and infers device info?

sgiehl commented 12 months ago

Matomo uses https://github.com/matomo-org/device-detector/ to detect device / model / client / os. It contains a big list of regular expression to look for certain fragments. The iOS SDK uses this to create the useragent: https://github.com/matomo-org/matomo-sdk-ios/blob/32c2353d5b57f9e144f199a544c7fe1df9561236/MatomoTracker/UserAgent.swift#L17-L22, maybe you can create something similar.

angelxmoreno commented 12 months ago

This is gold. Thank you so very much. @donni106 guess we have our answers.