Two words you often hear together are mobile and site speed. And that’s not without reason because these two go hand in hand. Mobile-friendliness and site speed are some of the most pressing matters we have to deal with as SEOs, developers, and site owners. Measuring page speed has always been something of a dark art. The site speed tools we use today are fairly adequate, but a new tool is trying to come at it from a different, more realistic angle: Google Lighthouse. Here, I’ll take a closer look at how to measure mobile site speed with Google Lighthouse.
What is Google Lighthouse?
Lighthouse is a tool built by Google and was originally meant to audit Progressive Web Apps (PWA). The tool executes four audits for accessibility, performance, Progressive Web Apps and an extended list of best practices. Together, these give you an excellent overview of the quality and performance of your website or web app.
Site speed is all about perception and user experience. Speed in numbers means nothing if your site still feels slow. Loads of users around the world are on rather crappy mobile connections of 3G or less. Even with lightning-fast 4G connections, a site can simply feel laggy and slow. And we all know what a devastating effect a slow site can have on your conversion. Shaving milliseconds of the time needed to load your site could make a world of difference.
While testing, Google Lighthouse simulates visiting your mobile site via a flaky 3G connection on a slightly underpowered device. Packets are lost in an attempt to simulate real-world conditions as authentically as possible. After running the test, you’ll get a report with a score and actionable advice with issues to tackle. Granted, the recently updated and redesigned Test My Site by Google is infinitely more beautiful, but also a lot less comprehensive.
PageSpeed Insights vs. Google Lighthouse
PageSpeed Insights is probably the most used site speed analysis tool out there. While it gives you a nice score and a list of possible improvements, it hardly gives you an idea of the perceived loading speed of your site. It brutally states that your site doesn’t follow the rules and it should, therefore, be slow for everyone. In addition, PageSpeed Insights gives recommendations that are hard, if not impossible to implement. Getting a 100/100 is a pipe dream for most sites.
The two most important things PageSpeed Insights looks at:
- Time to above-the-fold load: This is the time that it takes to fully render the above-the-fold content of a page from the moment a user requests your page.
- Time to full page load: This is the time that it takes to fully render the complete content of a page from the moment a user requests your page.
Lighthouse takes a much more practical approach and puts user experience front and center. It visits your site over a throttled 3G connection so it can emulate what a real visitor in the real world would experience. Instead of just loading your site like PageSpeed Insights does, Lighthouse checks how and when it responds to input. It finds the exact moment when your content is ready to use, so you can try and optimize that when it feels too slow.
What to look for in Lighthouse results
The whole concept of speeding up your mobile site is two-pronged; your site must be fast and it must feel fast. You, therefore, need to get your content on screen as fast as possible. Don’t let people wait. In addition, users must be able to interact with your content as soon as possible. Since Google announced that page speed is a ranking factor for SEO, you need to fix these issues.
What should your priority be? Load your content first. Awesome graphics and killer animations can wait. Your message – and what people are looking for – is most likely in the content. You can load the rest of the content in the background and ease it on the screen later on.
Metrics used
While measuring the performance of your mobile site, Lighthouse uses the following metrics:
- First meaningful paint: This determines how long it takes for the first meaningful content to appear onscreen. The lower the score, the faster that page appears.
- First interactive: This measures when a page is minimally interactive. This determines if most UI elements are interactive and if the screen responds in a reasonable manner to user input.
- Consistently interactive: This measures when a page is fully interactive.
- Perceptual speed index: This speed index shows how quickly the contents of a page are visibly populated. It also comes with a target loading time of <1,250 ms.
- Estimated latency input: This measures how long it takes for your page to respond to user input. A high latency will result in a page that feels sluggish or laggy. The target here is <50 ms.
- Critical requests chain: This network waterfall shows what resources are needed to initially render this page. Prioritize asset loading in the critical rendering path to speed up the page.
The Lighthouse report also features a number of opportunities to improve the site speed of your mobile site, including how much loading time they will save. These include reducing render-blocking stylesheets, render-blocking scripts, properly sizing images and fixing offscreen images.
All in all, Lighthouse gives you a tremendous amount of insight into the performance of your page. Use these insights to your advantage.
How to install Google Lighthouse
Getting started with Google Lighthouse is very easy as it is built into Chrome’s Developer Tools Audit panel (Mac: Shift+Cmd+I. Win: Ctrl+Shift+J or F12). From there, you can run the test and get the full report. In addition, there is a separate Chrome add-on for Lighthouse that adds a button to your toolbar, though using it stays the same.
You can also run Lighthouse as a Node package. This way, you can incorporate the test into your build process. When using the Node package, you will also see that there are a couple of audits that only work in a Node environment and not in the Audits panel of the DevTools.
To install Lighthouse globally from the command line use:
npm install -g lighthouse
If you want to run a test for https://example.com use:
lighthouse https://example.com
The full results of the audit will be available in the terminal, but also in a separate HTML file.
Testing Yoast.com in Lighthouse
It’s time to put Lighthouse through its paces. Let’s see what happens when I shine the spotlight of the lighthouse on yoast.com. Some of the audits are most useful for Progressive Web Apps. Now, Yoast.com isn’t available as web app yet, so we’re only focussing on the Performance tab here. This tab shows how your site or app performs currently and shows you ways to improve it.
In the screenshot below, you can see the results for yoast.com. The initial loading of the site is visualized by a bar showing when the content first appears onscreen. It shows how many milliseconds it takes for the content to become visible. The faster, the better.
Below that graphic, you’ll find the most important information, with a green, orange or red bar to show how well the performance is. When you want to optimize the performance of your mobile site, you need to watch the figures for first meaningful paint, first interactive and consistently interactive, as mentioned earlier. Also, try to lower the perceptual speed index and the estimated latency.
From the grades, you can see that yoast.com does OK with a 75 overall score. The first meaningful paint could be a bit better, but the first interactive and consistently interactive are good at 4,360ms. They even happen at the same time. That’s good news, as the site is completely useable at the moment it appears interactive. There also isn’t too much time between the first meaningful paint and the first interactive. While these scores are reasonable, the perceptual speed could be higher. In other words, the site appears to be rather fast but still could use some speeding up in the appearance part.
Implementing site speed fixes
There’s a lot you can do to improve your site speed. While explaining all the fixes is beyond the scope of this post, most optimizations can be found in the critical rendering path. The critical rendering path is formed by objects – like CSS and JavaScript – that have to load before the content can show up on screen. If this content is blocked, your page will render slowly or not at all. Pay attention to this and keep the path free of obstacles. Google’s Ilya Grigorik wrote a great guide on how to understand and improve the critical rendering path. And please, don’t forget to optimize your images!
Try it!
Google Lighthouse isn’t the one site speed tool to rule them all, but it is a very valuable addition to your toolkit. We know PageSpeed Insights is a fairly static tool that gives you a high-level overview of the performance of your site. Lighthouse, however, is more fine-grained and gives you immediate feedback based on real-world usage. You should definitely use it along with your other page speed test tools, like WebPageTest and GTmetrix.
Are you using Google Lighthouse? How do you find it? Please share your experiences and tips in the comments. Would love to hear from you!