: What is the screen size used by Google's PageSpeed Insights for mobile previews? Google's PageSpeed Insights allows one to check a website's speed issues for both desktop and smartphone devices.
Google's PageSpeed Insights allows one to check a website's speed issues for both desktop and smartphone devices.
I have some media query CSS for smartphones on my website, but I am unsure about PageSpeed's smartphone screen size. Does anyone know the screen width?
More posts by @Hamaas447
3 Comments
Sorted by latest first Latest Oldest Best
The exact viewport size of the PageSpeed Insights Checker varies.
This is probably to encourage real responsive web design instead of optimization for certain devices.
Additionally, if the viewport size was fixed, people might be able to target PageSpeed.
You can check What's my Viewport Size? with PageSpeed and see the used viewport size in the screenshot.
As statet in the comments and other answers, this will result in different viewport sizes.
Of course this doesn't tell whether the Algorithms in the back actually check at 1.024 px viewport width only. One would need to set up a proper experiment, which f.e. loads a way too big JPG @1 .025, and check if PageSpeed complains about it.
It's 320px wide.
To figure this out I ran Page Speed Insight (PSI) on a page with ranges of media queries that changed the background color at different breakpoints. After narrowing the width down to within 20px, I added a media query for every width within that 20px range until I found exactly the width PSI was using.
The reason this is (arguably) important is, for me, I was attempting to get my portfolio site a 100 PSI score as an exercise. My smallest media query is max-width="600px". I was using responsive images with picturefill setting the smallest image in the srcset to the largest the images would appear at my smallest breakpoint (600px + 80px padding = 520px wide images) but was getting an awful PSI score. Adding a smaller, 320px wide image to the srcset fixed the score.
The reason I say arguably is that, for real-world usage, my page was optimized perfectly without caring about PSI's viewport width. But my goal was specifically to get a high PSI score therefore it was important to figure this number out.
As stated in Google's PageSpeed Insights FAQ:
Does PageSpeed Insights use a real device? PageSpeed Insights' analysis does not use real devices. PageSpeed Insights fetches a site
with a webkit renderer (the same rendering engine that powers Chrome
and Safari) that emulates both mobile device and desktop devices.
Therefore, screen width should not be a factor as it will render accordingly in WebKit.
As long as you're using a common screen width, you should be fine. As stated in Google's Webmaster Central Blog on Responsive Design and Media Queries:
The default viewport width for the default Android browser is 800px,
and 980px for iOS,
So for both target OS's, you might use 800px for landscape smartphones, portrait tablets, and narrow desktops, and 479px for smartphones in portrait mode.
An example from the blog is:
@media screen and (min-width:480px) and (max-width:800px) {
/* Target landscape smartphones, portrait tablets, narrow desktops
*/
}
@media screen and (max-width:479px) {
/* Target portrait smartphones */
}
The following is a list of viewport widths for specific devices should you need to target one: Web Design for Mobiles and Tablets – Viewport Sizes
Alternatively, using the following would set the viewport to the default width of the device automatically, and should work in PageSpeed Insights too:
<meta name="viewport" content="width=device-width, initial-scale=1">
In summary, if your screen width renders fine in mobile browsers, it should render fine in PageSpeed Insights as well.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.