PageSpeed Insights Guide PDF
PageSpeed Insights Guide PDF
PageSpeed Insights Guide PDF
BY GOOGLE:
The 2020 Guide
wp-rocket.me
PAGESPEED INSIGHTS BY GOOGLE: THE 2020 GUIDE 1
Founded in 2014 in France, WP Media is a distributed company of more than 20 WordPress
lovers living in the four corners of the world. We develop plugins that make the web a better
place — faster, lighter, and easier to use.
INTRODUCTION
Why a Book About PageSpeed Insights by Google?
CHAPTER 1
PageSpeed Insights by Google: an Overview
CHAPTER 2
What is PageSpeed Insights and How Does It Work?
CHAPTER 3
Why you Shouldn’t Care About Google PageSpeed Insights
Scores
CHAPTER 4
PageSpeed Insights Is Now Powered by Lighthouse:
How to Read the New Audit?
CHAPTER 5
How to Address Google PageSpeed Insights
Recommendations
CHAPTER 6
How to Use WP Rocket to Improve Your PageSpeed
Insights’ Scores
Why a Book About
PageSpeed Insights
by Google?
When it comes to measuring your page speed, there are plenty of testing
tools to choose from. Some of them are very intuitive, others go deeper and
provide tons of metrics.
From PageSpeed Insights to GTMetrix, Pingdom, or WebPageTest, you’re
spoiled when it comes to the choices that are available.
We’ll show you how to use it and understand its results, and how to fix its
most common recommendations. We’ll also suggest some alternative
testing tools.
Google launched the first version of PageSpeed Insights around 2013. They
wanted to provide a tool for performance analysis and make it usable for a
broader audience.
For this purpose, they built a tool that returns a performance score and provides
suggestions on how to improve it. Auditing is available for both desktop, and
mobile devices.
This PageSpeed Insights 2020 Guide will take you through the secrets of this
essential tool, and will show how to make the most of it.
Since the end of 2018, PageSpeed Insights is powered by another tool from the
Google family: Lighthouse.
While the scoring system didn’t change its appearance, several under-the-hood
mechanisms modified the way a PSI report should be read.
That’s why we dedicated a chapter of this ebook to how to read the new
PageSpeed audit powered by Lighthouse.
On the other hand, we can’t stress this enough: it’s imperative to use PageSpeed
Insights as only one of the tools to assess the health of your website’s performance.
PSI scores shouldn’t give you headaches. They’re not a universal truth.
In our chapter about why you shouldn’t care about PageSpeed scores, you’ll
understand why.
We’ll see how to interpret their meaning, what the easiest fixes are, and when
you shouldn’t worry too much about them. Above all, you’ll understand why
getting a 100% PageSpeed Insights score may not be a realistic expectation.
One of the most frequent questions our Customer Support team receives here
at WP Rocket is “How can I get a 100/100 score with PageSpeed Insights?”.
How many times, while measuring your website speed, have you asked yourself
a similar question?
The Google team has always been on the front line of web performance
optimization and tooling. Over the last ten years, they developed a series of
performance tools dedicated to different types of users: from developers to
marketers to amateur website owners, there’s a Google tool suitable for every
need!
Google’s paternity allowed PageSpeed to rapidly gain a high reputation since its
launch in 2013.
However, the perfect speed test tool doesn’t exist: so PageSpeed Insights
shouldn’t be considered the only voice of truth, but a good ally for your web
page performance assessments, along with other equally valid tools.
With this guide, you’ll get to know PageSpeed Insights from its core; you’ll
understand how its famous score system works and what exactly does it
measure.
PageSpeed Insights is powered by Lighthouse since the end of 2018. This means
that the results in your PSI reports are based on the Lighthouse API. We’ll analyse
the meaning of it in Chapter 4.
When scanning a page, PageSpeed provides two types of data about it: Lab
and Field data.
On the other hand, Field data (also called Real User Monitoring or RUM) includes
performance data coming from real page loads. It’s effective to capture true, real-
world user experience, but the set of metrics is limited as well as its debugging
potential.
Speed score
Field data
Field data is based on real-world Chrome users experience over the last 30 days: it
includes First Contentful Paint (FCP) and First Input Delay (FID).
Lab data
Opportunities
Diagnostics
The Diagnostics section provides recommendations about which best practices for
web development should be added to the page.
Passed audits
The Passed Audits section includes all the performance checks the page already
meets and that don’t need any intervention.
The most important thing to notice in this context is that Lighthouse simulates a
page load in a particular environment: mobile networks and mid-tier device.
Google clarifies that only the items in the Metrics section of the Lighthouse’s
Performance category contribute to the score. The recommendations appearing
under Diagnostic and Opportunities are not part of the score.
Performance
If you’re curious to know how each metric contribute to the final score, see
Google’s spreadsheet with the scoring details.
But now that you understand how the final score is calculated, it’ll be easier to
understand why scoring 100/100 is incredibly tricky nowadays.
Obtaining a green PageSpeed Insights score can, of course, feel rewarding, but
the real question to ask yourself should be different: does that single PageSpeed
score really say something meaningful about my website?
In our opinion, it doesn’t (and here’s why you shouldn’t care about your Google
PageSpeed score).
For example, applying some code optimization techniques (like deferring non-
critical JS files or unused CSS), could be an excellent way to improve the first
paint of your pages, and obtain a green score.
The lower loading time your site will obtain on the six Performance metrics
indicated above, the better its overall score will be.
The mere PageSpeed score your site obtains won’t influence Google’s ranking:
that number alone is not an indicator of an “SEO grade.“
So there’s not a direct correlation between how your site scores, and the position
it will gain in the SERP.
A good score is a fair indicator of the well-being of your site in the eyes of Google.
But it won’t guarantee the victory in the race to the top of the SERP.
Your efforts should then be focused on making sure your website loads as fast
as it can: page speed is the real ranking factor, not the score.
To learn how you can achieve this goal, you can start from our blog post about
page speed optimization for WordPress and the errors to avoid.
You’ve probably added a caching plugin, hopefully WP Rocket (if not, get it from
here!), and now you want to know how much benefit you’re getting.
So you head over to Google PageSpeed Insights, because that’s what all the
articles tell you to do, and enter your URL.
?
“What are all these red and orange warnings?”
“Why isn’t my grade higher?”
“What do all these recommendations mean?”
After adding caching to your site, you might be expecting that your PageSpeed
grade will be near-perfect. Or you’ll look at the recommendations and wonder
why your caching plugin hasn’t fixed them all, automatically.
A lot of customers ask us why their PageSpeed grade isn’t higher, or they assume
that because it didn’t increase a lot, it must mean WP Rocket isn’t making their
site faster.
The simple truth is this:
Did you know that Google PageSpeed doesn’t even measure the loading
time of your site?
Read that again:
Google PageSpeed does not actually measure the speed of your site.
We’ll see this in more detail in the chapter dedicated to the new PageSpeed API,
which is now based on a different analysis engine, Lighthouse.
Here are 3 websites all with similar load times, but with vastly differing
PageSpeed scores:
1. PurePlanetRecycling
Pingdom Test
3. CheekyPunter.com
Pingdom Test
4. Anonymous URL
Pingdom Test
So you can see from these examples that the Google PageSpeed grade
is not a real indicator of speed.
If you try an attain a perfect grade, by implementing all the suggestions Google
PageSpeed makes, you will lose your sanity pretty quickly.
You cannot take too literally all of the suggestions from Google PageSpeed
because sometimes they are unrealistic or impossible.
For example, it may tell you to minify or add expire headers to a file that is not
hosted on your website. This is impossible.
WP Rocket adds the rules for GZIP by default so if PageSpeed gives you a
warning, this might be a sign your server does not have it activated.
Or it might alert you that you have too many large images which could be
compressed. This is a good recommendation which you can actually act on:
Image Optimization – An Easy Win For A Faster Site
So it’s best to look at PageSpeed as one of several tools in your arsenal that
might provide some pointers, but your goal should always be to improve your
actual speed, not your “PageSpeed“ grade.
PageSpeed Insights Is
Now Powered by Lighthouse:
How to Read the New Audit?
In November 2018, Google released v5 of its PageSpeed Insights API, which now
implements Lighthouse technology and integrates field data provided by the
Chrome User Experience Report (CrUX).
This new version got a mixed response from the public: while some people
started to see PSI scores skyrocketing, others plunged in despair looking at how
their scores dropped.
If you have followed WP Rocket since the beginning, you know that we believe
that a reliable web performance optimization score shouldn’t depend on
PageSpeed Insights only.
But since Google’s tools are among the most used when it comes to running a
performance audit, let’s see together what changed with the new PageSpeed
Insights, and which key points you should always keep in mind when pondering
its recommendations.
Until now, Google was relying on several performance tools to assess the
performance of websites, such as PageSpeed Insights, WebPageTest, Test My
Site, Chrome Developer Tools and Lighthouse.
That’s why, according to Google, it was time to make things easier and allow
developers to obtain the same performance recommendations everywhere, no
matter which Google tool they decided to use.
Now that Lighthouse powers PageSpeed Insights, you should obtain the same
result whether you choose to get your performance recommendations from the
web, the command line, or Chrome DevTools.
Keeping in mind this context it’s worth noting that, with this new tool, Google
is targeting a very specific type of users: developers and tech-savvy people
that already have a good knowledge of web performance best practices and
solutions.
Now, before stepping into the details of the new PageSpeed Insight API, let’s
clarify what Google Lighthouse is.
From now on, the new PageSpeed Insights requires all of us to adjust the way we
read performance scores and interpret Web Performance Optimization audits.
When you measure a page with PageSpeed Insights, the result includes both
lab and field data about that page.
This is how Google explains the difference between lab and field data:
Field data, on the other hand, is based on a set of historical stats about how
a specific page has performed ”in the real world”: it considers anonymized
performance data from real users who visited the page from different devices
and network conditions.
This data is stored on the Chrome User Experience Report dataset and is
depicted in the user interface as a classification of speed: a green bar for fast
pages, an orange bar for average pages, and a red bar for slow pages.
It’s important to note that not all sites may have enough field data available for
display.
Now that all PSI results are based on Lighthouse, we have to interpret results
differently, and for a simple reason: Lighthouse simulates a page load on mobile
networks and mid-tier devices.
Now that you know that mobile is prioritized by Google and its Lighthouse tool,
let’s look at three key points to keep in mind when running a PageSpeed Insight
test with the new API:
Suppose your server is in Atlanta, closest to your target audience, while the test
server used by PageSpeed Insights is, let’s say, in Los Angeles.
You’ll get results that don’t represent a real-world scenario in which a visitor
located in Atlanta would experience lower loading time, being geographically
closer to your server.
That’s why we always suggest completing your performance audit using tools
like Pingdom and GTMetrix, which allow you to choose different server locations
(for GTMetrix, you need to create an account to access the server locations list).
The latest technology smartphone would take significantly less time to load a
page compared, under the same network conditions, to one that is even just a
couple of years older.
Ok :)
1. Opportunities
2. Diagnostics
The Diagnostics section, on the other hand, focuses more on the best practices
for web development that should be implemented into the analyzed page.
During this chapter, we’re going to walk you through the most common
PageSpeed Insights recommendations: we’ll explain them in plain English and
then we’ll see how to fix them or, at least, how to put them into the right context.
Example of the Opportunity section: removing unused CSS could reduce this pages
load time by 0.45 seconds.
With this recommendation, Google wants you to remove or defer JS and CSS
files that interfere with loading the above the fold content of your webpages.
Above the fold content is the content your users see as soon as they open the
page, before they start scrolling.
This is also the case of the so called unused CSS, such as stylesheets that might
be needed after the page is loaded, i.e. the CSS of a modal window appearing
only after clicking a specific button.
So, how to defer the loading of render-blocking JS/CSS and defer unused CSS?
Manually approaching this tweak might be a bit tricky, since it involves digging
and editing your code.
It’s worth noticing that, sometimes, it can be very difficult (if not impossible) to
completely eliminate all render-blocking CSS and JS. The possibility to achieve
this result will highly depend on how the theme and plugins you’re using on your
WordPress site are coded.
If you didn’t code your website from scratch yourself, and you’re instead relying
on a theme and plugins other developers wrote, you simply have to accept that
you can’t have 100% control over them.
It’s ok to not defer ALL of your CSS and JS render-blocking resources, since
sometimes this process can lead to a broken page (and that’s way worse than a
“red score“ by Google PageSpeed Insight!).
When Google PageSpeed asks you to reduce server response time, it’s basically
referring to the indicator known as Time to First Byte.
We already addressed this topic with our guide: Time to first byte: how to test,
interpret and reduce it!
These two recommendations are related to one of the most popular code
optimization techniques: minification.
Minification is the technique that makes HTML pages, CSS and JS scripts less
readable (for humans, of course) but faster to load!
Developers in fact may need comments, markup and spacing to make pages
and scripts more readable during their development process.
But when their masterpiece is over and the website is online, all those additional
elements become redundant: they increase network traffic, and burden the
bandwidth of network requests.
That’s when minification comes handy: it makes the code leaner, so the final user
will receive it faster and the overall load time will improve.
To know how you can manually minify your files, have a look at our guide: Best
CSS and JS Minification Tools.
To automatically take care of minification, and forget manual tweaks, you can
use a WordPress plugin.
There are many efficient minification plugins on the market, but, again, WP
Rocket could be the perfect solution for you! 🚀
Our plugin includes both CSS and JS minification, as well as CSS and JS combination:
Here’s a definition from our guide about the differences between preload, prefetch,
and preconnect:
“With prefetch, you can tell the browser to fetch resources you think the user might
need later as part of a future navigation or interaction, if the user takes the action you’re
expecting. These resources will then be fetched at the lowest priority in the browser,
when the current page is done loading and there’s bandwidth available.”
(Source: Preload, Prefetch, Preconnect: How to Speed Up Your Site With Browser Resource Hints)
In particular, with DNS prefetching you can tell the browser to perform DNS lookups
on a page while the users are browsing it: when the external resources get requested,
the DNS resolution would have already been processed, reducing the latency.
Prefetching DNS requests can give your loading time a minor boost, and you can
easily apply it (and make PageSpeed happy) with WP Rocket:
In particular, with DNS prefetching you can tell the browser to perform DNS
lookups on a page while the users are browsing it: when the external resources
get requested, the DNS resolution would have already been processed, reducing
the latency.
Prefetching DNS requests can give your loading time a minor boost, and you
can easily apply it (and make PageSpeed happy) with WP Rocket:
This warning refers to the Critical Rendering Path (CRP) optimization strategy.
CRP is useful to prioritize some resources before others, and decide their loading
order.
In this way, the browser can load a page faster.
To fix this PSI recommendation, you should declare preload links in your HTML,
so the browser knows that it has to download critical resources as soon as
possible.
WP Rocket allows you to take care of this warning for CSS files only: by enabling
the Optimize CSS Delivery option, WP Rocket adds the rel=”preload” attribute to
CSS files.
Offscreen images are those that don’t appear when the user opens a page. They
are the so-called below-the-fold images.
Since users can’t see them when they load a page, there’s no point in downloading
them as part of the loading process.
LazyLoad is a technique that allows you to defer image loading (to know more
about LazyLoad and how to apply it to your images, read our guide).
You can manually lazyload your image files, or use a plugin instead.
If you opt for this second option, you have two great alternatives:
• Our standalone free LazyLoad plugin, which you can find on the WordPress.
org repository:
By choosing one of the two, PageSpeed Insights will be satisfied and it should
fix the warning about offscreen images not deferred.
Just keep in mind that, as far as WP Rocket’s LazyLoad is concerned, not all
images can be lazy loaded at the moment, e.g. background images that are
loaded from stylesheets.
To learn where this exceptions apply, have a look at our documentation.
These image formats are superior to their “older” siblings, JPEG and PNG images,
in terms of quality and compression features: they are able to load faster and
consume less mobile data.
Some browsers, while waiting for fonts to load, hide text in the page, producing
the effect known as the “flash of invisible text”.
But this solution doesn’t facilitate user experience: the ideal solution, in this case,
would be to let users immediately see the text using a system font.
This will produce the so-called “flash of unstyled text” effect: but defaulting to a
system font will make the browser save important loading time, since it will be
using a font it already has in its system.
Once the web font you originally chose is completely downloaded it will be
visible to the user; nobody will have to wait staring at invisible text on the page,
if you opt for a “flash of unstyled text” solution.
WP Rocket 3.3.5 introduced support for Google Fonts using the “swap” font-
display property:
This means that, if you’re using Google fonts, WP Rocket will help to take care of
the “flash of unstyled text” effect.
Basic Settings
JS comes at a high cost for your website: once downloaded, it has to be “read”
and “understood” by the browser (parsed and compiled) and is then executed
within the browser.
As per the note about “Minimize main-thread work“, this is how PageSpeed
defines it:
“Consider reducing the time spent parsing, compiling and executing JS. You may
find delivering smaller JS payloads helps with this.”
You can use specific plugins that can help you remove
unwanted JS from your pages, such as:
There are several layers of cache available that you should audit and apply,
whenever possible, to your site: page caching, server-side caching, object
caching and browser caching.
When Google PageSpeed asks to serve static assets with an efficient cache
policy, it’s referring to browser caching.
To learn how to tackle this warning, you can read our guide on how to correct the
static cache warning in PageSpeed.
If you’re using WP Rocket, you don’t have to worry about this: our plugin
automatically applies the necessary Expire headers in the htaccess file.
If you’re using an NGINX server, you won’t have the htaccess file, so the above
mentioned headers won’t be applied.
However, WP Rocket works out of the box on NGINX servers: here you can find
more info about it.
This note refers to the Critical Request Chains, that is the list of resources
which are loaded with a high priority on a page. This is not an audit that you’re
meant to “pass” or “fail”, but if you address it you’ll be able to improve page load
performance on your site.
Learning how to use performance testing tools to assess the health of your site
is a crucial asset. Once you understand how to read their reports, improving
scores, and fixing their recommendations will become a lot easier.
WP Rocket is one of the tools that will help you achieve this goal efficiently and
without stressing too much on configuration settings.
PageSpeed Insights will love this and reward your site immediately, improving its
performance score.
Then, you have WP Rocket’s optional settings. They’re not mandatory since your
website will be faster already, even if you don’t try them.
Proper use of these settings will not only make your site blazing fast, but will also
boost its performance. You’ll achieve faster page speeds, better SEO rankings,
and the best scores in PageSpeed Insights (or other performance tools).
Most of the WP Rocket’s options that will make PageSpeed Insights fall in love
with your site are included in the File Optimization tab.
These refer to the fact that it’s recommended to delay (defer) the loading of non-
critical files until the browser is done rendering the page.
WP Rocket helps you to solve this puzzle thanks to the options labeled as
Optimize CSS Delivery:
On the other hand, the Media tab contains the options that will fix PSI
recommendations related to images like Defer offscreen images.
Discover WP Rocket!
wp-rocket.me
PAGESPEED INSIGHTS BY GOOGLE: THE 2020 GUIDE 45