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
piwik.JS: devicePixelRatio detection covers only Apple devices #4663
Comments
If there is a bug in the devicePixelRatio we'd like to fix it for sure! Could you give some examples of how changing the code, would change the data? ie. what use case/bug would it solve? |
We only maintain regular expressions to detect devices, brands, models, etc. we don't maintain list of user agents, except of course in our extensive test suite which tests more than 1000 user agents after each commit. It will be a challenge to maintain this list for sure, but we call on the community to help us improve it over time and add new devices and models and brands and browsers and operating systems. |
ok, I'll try to isolate the issue with the android resolutions tracked on a local installation. Another possible cross-check whether this is actually a bug would be to take a real-world dataset (like the piwik forums and/or website) and segment some popular hi-res Android devices (from "device model" report, e.g. the I unfotunately don't have such a dataset yet because we're not yet live with piwik. |
remove the underscores, I was fighting with the trac spam filter |
ie. what use case/bug would it solve? we would need to know whether it is a bug or a new feature request, i'm not sure yet... |
devicePixelRatio won't be considered at all anymore. See #10289 |
The devicePixelRatio detection in https://github.com/piwik/piwik/blob/master/js/piwik.js#L2242 makes a simple assumption that only Apple Retina devices have a physical screen resolution that differs from the logical (CSS pixel) resolution.
That leads to the issue that e.g. most Android hi-res devices aren't correctly detected and neither Win8 ones.
You can find a list of real CSS Pixel ratios here: http://en.wikipedia.org/wiki/List_of_displays_by_pixel_density Unfortunately not all Devices are configured on 1 1.5 2 2.5 3 etc... but some use in-between ratios.
My suggestion would be to use this (established) polyfill instead of the UA regexp:
https://github.com/tysonmatanich/GetDevicePixelRatio/blob/master/getDevicePixelRatio.js
but I would add a rounding to 0.5 precision to not spam the Data with random outliers.
did I miss something? I'm not sure how such a change affects backwards compatibility of the data. If backwards compatibility is an issue (have to think about retina displays on desktops, too!), An alternative would be to define "res" as CSS resolution and report devicePixelRatio separately (See my P.P.S. below).
Greets, interested to hear what you think.
Nikolaus
P.S.: Concerning the devicesDetection Plugin: I think it would be a never-ending uphill battle to try to maintain an always-up-to-date mapping of UA strings to devicePixelRatios on the server, which would be inherently unreliable all the time as Vendors are starting to anonymize the UA strings of the devices more and more.
P.P.S.:
Keywords: js resolution detection
The text was updated successfully, but these errors were encountered: