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.82k stars 2.64k forks source link

Record real device resolution and devicepixelratio #11405

Open m0uH opened 7 years ago

m0uH commented 7 years ago

I think it's really confusing if UHD devices like 4k monitors and smartphones get listed under visitor devices with the "wrong" resolution. As stated in #10296 it does make sense from a website point of view but in this way you can't differentiate between HiDPI devices and normal devices. E.g. it could be worth or necessary to provide images on a website with higher resolutions if more and more users with HiDPI displays are going to visit a website. With the current state this could not be tracked.

A solution could be to simply record both, the real screen resolution, which should also be presented under the device informations, and the "actual" resolution / viewport size.

tsteur commented 7 years ago

A devicePixelRatio report could be good as well 👍

johsin18 commented 6 years ago

So I have implemented a plugin for reporting statistics on the device pixel ratio here: https://github.com/johsin18/DevicePixelRatioMatomoPlugin

It does not change the screen resolution report at all. This is how it should stay IMHO, it would make sense though to rename "Screen Resolution" to "Screen Size (in CSS pixels)".

A code review of my plugin by an expert would be appreciated. I'm currently testing it on my private Matomo instance, it seems to work fine. If everything goes well, I would enroll it to the Marketplace in a week or so.

johsin18 commented 6 years ago

I have published the plugin now. @tsteur @sgiehl a code review would still be appreciated.

GreenReaper commented 5 years ago

This is useful, but the combination of this and the existing CSS pixels to provide statistics on the "actual" screen resolution would be even more useful. Then we could have a better idea of what srcset images will be used, since if you have a fixed viewport it can be scaled to the device resolution. Any device can advertise a 4.0 device pixel ratio, but if it has 320 width it is equivalent to a 2.0 dpr with a 640 width.

I imagine this'd be relatively trivial to calculate and display as a separate table from non-archived data, as hinted at in this comment. Archived history would be useful too, to show changes over time.

As noted the regular table "screen resolution" is now misleading because it doesn't list screen resolutions, but instead the number of CSS pixels. For designers this may be useful, but knowing the actual screen resolution is important when deciding the appropriate size of image resources and videos to provide.