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 Detection for Mac broken since 7.3 #361

Closed
lrrrs opened this issue Nov 15, 2020 · 4 comments · Fixed by #362
Closed

Device Detection for Mac broken since 7.3 #361

lrrrs opened this issue Nov 15, 2020 · 4 comments · Fixed by #362
Labels

Comments

@lrrrs
Copy link

lrrrs commented Nov 15, 2020

I recently updated the Matomo SDK in my app to the latest version (7.3). Looking at the operation system statistics, more and more generic Mac systems w/o a detected version number popped up. I'm realizing now that it's completely broken since this change #353.

A generated User-Agent from my Mac app looks like this:

AppName/1.0 x86_64 macOS/11.0.1 MatomoTrackerSDK/7.3 Darwin/20.1.0

And trying it out with the device detector demo confirms, that it's broken.

The old User-Agent generated from an earlier SDK version obviously works (But detects the OS wrong, it's 11.0 or 10.16 and not 10.15.6):

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) MatomoTracker SDK URLSessionDispatcher

The question is: Should this be fixed in the client iOS/Mac SDK or on the server side? Help? 😊

@brototyp
Copy link
Member

brototyp commented Nov 15, 2020

Hi @lrrrs, thanks for reporting this issue.

I just had a look at it. Apparently the old mechanism did report a macOS version that could be recognized, but it sometimes was wrong. This for example is how the old version on 11.0.1 looks like (apparently webkit reports this wrong / differently).

For the issue you reported: I think the issue is the macOS I defined the OS name too. Looks like the detector only accepts Mac OS X. I'll create a PR in that regard. Do you mind having a look?

This is the PR: #362

@Findus23
Copy link
Member

I guess Apple uses Mac OS X for historical reasons in their user agents and changing it would break a lot of things/sites.
But I think adding macOS to devicedetector wouldn't be unreasonable too. (but only fix this for future versions)

@lrrrs
Copy link
Author

lrrrs commented Nov 15, 2020

Yes, since 2016 it's called macOS, but to not break the whole internet I guess User-Agents in Safari, etc. are still reporting it as Mac OS X. Anyways. Thanks for the fix @brototyp. Just made a test using your branch and it can detect the version again.

@lrrrs
Copy link
Author

lrrrs commented Nov 16, 2020

I'm trying to do a quick temporary fix in the device detector. Would this be the right place (It does not seem to change anything):

vendor/piwik/device-detector/regexes/oss.yml

Add this rule:

- regex: 'macOS(?:[ /](?:Version )?(\d+(?:[_\.]\d+)+))?'
  name: 'Mac'
  version: '$1'

Testing it via Matomo > Diagnostics > Device Detection seems to work fine:

Screen Shot 2020-11-16 at 12 08 05

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants