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

Device Model Name #347

Closed
goelay opened this issue Sep 11, 2020 · 14 comments
Closed

Device Model Name #347

goelay opened this issue Sep 11, 2020 · 14 comments
Labels
information needed We need more details to progress this issue.

Comments

@goelay
Copy link

goelay commented Sep 11, 2020

Hello,
We are experience an issue where I am seeing seeing few model being reported as "Apple - iPhone" & "Apple - iPAD" instead of the device exact name.

@Guiboune
Copy link

Same here

@brototyp
Copy link
Member

Hey, thanks for reporting. Do you have any details? Do you know if this any specific iOS version, or any specific devices where this happens?

@brototyp brototyp added the information needed We need more details to progress this issue. label Sep 16, 2020
@goelay
Copy link
Author

goelay commented Sep 16, 2020

Hey,
It's not OS specific. We are not able to get info for specific device its occurring but its very easily replicable.

@brototyp
Copy link
Member

So it's only happening for a few specific devices? Do you know which devices?

@goelay
Copy link
Author

goelay commented Sep 16, 2020

Its happening for majority of the devices I believe as per our analysis. We do not know the devices.
Screenshot 2020-09-16 at 3 40 22 PM

@brototyp
Copy link
Member

Hm. That's interesting. Did that change appear along with an update of the SDK? Or maybe an update of the backend?

@goelay
Copy link
Author

goelay commented Sep 16, 2020

We are on latest version and we are seeing this issue from a long time so it's not related to version I suppose.

@Findus23
Copy link
Member

It would be great if you could check the server access log for user agents (ideally of those unspecific visits). That way you can check on https://devicedetector.lw1.at/ how Matomo detects that specific user agent and maybe check if some information about the exact device is missing there.

@ghost
Copy link

ghost commented Sep 16, 2020

Hello,

I guess the issue is from the devicedetector.lw1.at because even if I go to this url from iPhone 8, it says only iPhone as model property.

@Findus23
Copy link
Member

@BastienLebrun That's another issue: Apple does intentionally not mention the exact device type in the user agents anymore for privacy reasons when browsing in Safari, so there is nothing for Matomo to detect.

But that should not affect the iOS SDK as there the user agent can be built by the SDK code.

@brototyp
Copy link
Member

brototyp commented Sep 19, 2020

Hey @BastienLebrun, @goelay and @Guiboune, thanks a lot for the followup. In theory, the SDK does modify the user agent, so that it contains the actual device identifier, such as iPad3,6 instead of just iPhone.

To figure out where exactly the problem is: Do you use the latest version (7.2.2) of Matomo? If that's the case, can you please check out the branch over here, install it in your app and right after initializing the MatomoTracker add a matomoTracker.logger = DefaultLogger(minLevel: .verbose)? This should print something like MatomoTracker [V] Generated User Agent: Mozilla/5.0 (x86_64; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MatomoTracker SDK URLSessionDispatcher in the console. If you run this on a device that is not recognized on the server, we can figure out what the generated user agent is, and maybe that helps to get closer to the issue.

@Findus23
Copy link
Member

@brototyp You are right that the only way to specify the device in Matomo is the user agent. It will be parsed by https://github.com/matomo-org/device-detector which gives the results users can see in Matomo.
For apple devices it uses the regex here:
https://github.com/matomo-org/device-detector/blob/c495cee660e1e8113fdea7929c659dd6943aae4d/regexes/device/mobiles.yml#L477

On https://devicedetector.lw1.at/ you can test the output of the latest version (master branch), so it might slightly differ from the one shipped in Matomo, but it shouldn't matter here.

Unfortunately user agents have no defined format as every device sends what they think is right. With iOS devices it is easier as they all have the same schema and contain the internal name of the device (maybe you can get the same name programmatically).

The user agent

Mozilla/5.0 (x86_64; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MatomoTracker SDK URLSessionDispatcher

contains no info about the device, so there is nothing that could be detected.

BTW: Do you know if you currently still send iOS user agents for iPads? Safari sends a macOS user agent by default to get websites to display desktop sites. (matomo-org/device-detector#6313)

@brototyp
Copy link
Member

brototyp commented Oct 4, 2020

Thanks both of you for the feedback.

I think we need to rethink our UserAgent generation. Right now the SDK asks the WebView to generate the UserAgent and will then replace iPhone with the actual iPhone version. There are just to many issues with it:

  • WebKit as a dependency
  • Asynchronous code: There is no synchronous way to let a WKWebView generate the UserAgent
  • When the format of the UserAgent returned by WkWebView changes our code might break (I guess that's what is happening here)

I opened a PR that completely changes, how we generate the UserAgent. @BastienLebrun, @goelay and @Guiboune can you please have a look at it, to see if it works in your case?

@brototyp
Copy link
Member

The latest release, version 7.3, contains a major update un user agent generation that should fix this issue.
I will close this ticket for now. Please feel free to comment here, if it doesn't.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
information needed We need more details to progress this issue.
Projects
None yet
Development

No branches or pull requests

4 participants