Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
donni106 opened this issue Dec 20, 2022 · 6 comments
Open

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

donni106 opened this issue Dec 20, 2022 · 6 comments
Labels
c: Documentation For issues related to in-app product help messages, or to the Matomo knowledge base.

Comments

@donni106
Copy link

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 donni106/matomo-tracker-react-native#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

@donni106 donni106 added the To Triage An issue awaiting triage by a Matomo core team member label Dec 20, 2022
@sgiehl
Copy link
Member

sgiehl commented Dec 20, 2022

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:

matomo/js/piwik.js

Lines 3070 to 3088 in 2c63f27

clientHints = {
brands: navigatorAlias.userAgentData.brands,
platform: navigatorAlias.userAgentData.platform
};
// try to gather high entropy values
// currently this methods simply returns the requested values through a Promise
// In later versions it might require a user permission
navigatorAlias.userAgentData.getHighEntropyValues(
['brands', 'model', 'platform', 'platformVersion', 'uaFullVersion', 'fullVersionList']
).then(function(ua) {
var i;
if (ua.fullVersionList) {
// if fullVersionList is available, brands and uaFullVersion isn't needed
delete ua.brands;
delete ua.uaFullVersion;
}
clientHints = ua;

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.

@sgiehl sgiehl added c: Documentation For issues related to in-app product help messages, or to the Matomo knowledge base. and removed To Triage An issue awaiting triage by a Matomo core team member labels Dec 20, 2022
@sgiehl sgiehl added this to the For Prioritization milestone Dec 20, 2022
@angelxmoreno
Copy link

angelxmoreno commented Nov 12, 2023

@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
Copy link
Member

sgiehl commented Nov 17, 2023

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
Copy link

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
Copy link
Member

sgiehl commented Nov 20, 2023

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: Documentation For issues related to in-app product help messages, or to the Matomo knowledge base.
Projects
None yet
Development

No branches or pull requests

3 participants