During the last rebuild of my site at least two years ago I started to track the viewport sizes of my visitors via Google Analytics. Since I don’t care much about screen resolution (screen size), I don’t bother to track it.
This motivated me to jump into my Google Analytics and pull the viewport data that I have. The chart below represents what I found:
What I’ve done is grabbed the last 500 visits to my site for which I have data (even bad data) and plotted them in a scatter chart without regard to the frequency of a particular resolution. To be clear, this isn’t scrubbed data and it’s not from a site targeted at the general web user.
Hopefully that’s enough to get your started on tracking viewport stats for visitors to your site. If you see ways I can improve it, then please do let me know. I can update this and we can all benefit.
If you are curious why I chose to skip tracking screen size and just focus on viewport size, I refer you to an article I wrote 13 years ago, along with more recent articles from me and others.
To quote PPK, screen.width is useless. Devices don’t consistently report device pixels or viewports in a consistent way. There is clearly still value in having some numbers, though the quality of those numbers is always suspect.
Hi Adrian, thanks for the should out in the post post.
I'm always really happy to see posts that focus on viewport size (rather than screensize), and even happier when making use of the method I described to capture and store the data!
One thing I'd love to be able to do is improve the script to measure the part of the canvas visble on tablet and mobile screens. Viewport size doesn't give the true picture of what the user is seeing on those devices.
As I am sure you can see, I've been trying to push viewport size over screen size for well over a decade now. Your script makes it easier for any web developer to add it and report on it now.
Running comparisons against screen resolution data in Google Analytics is interesting and I'll be comparing and contrasting viewport and screen sizes in a later post. Your more recent post already does a nice job of showing some of that disparity.
Thanks for writing that GA script. Nice time saver.