How to Use Google Lighthouse Audits to Improve Speed
You are probably familiar with the following story: you spend a lot of time reading about how to speed up your WordPress blog, and install tools and free plugins to do so. Then you (or your client) make a seemingly small change to one of your pages, and your page speed suddenly falls off a cliff.
If you are serious about improving your website speed, you should be checking your speed regularly, in which case you can spot this problem pretty quickly. However, it would still be nice if there was an automated way of checking your WordPress site speed every time you make a change. Thankfully, there is a solution.
That solution is to configure Google Lighthouse to perform speed audits on demand for your WordPress site. Setting this up can be a little long-winded, but is also not that complicated for the advanced user. In this article, we’ll explain why and how you should set up Lighthouse CI for your WordPress site.
An Intro to WordPress Speed Testing
First let’s take a closer look at why you need to speed test your WordPress site, and the standard ways that are available to do that.
There are essentially two reasons why your website – whether it is based on WordPress or not – needs to be fast. One is simply that the attention span of the average web user is already very short, with 47% of consumers expecting a web page to load in less than two seconds, and they will quickly abandon a page if it takes too long to load. For this reason, reducing load times is a crucial concern for e-commerce stores in particular.
The second reason is a little more technical, but no less important. Google has been utilizing site speed as a ranking signal since 2010. As a result, the speed of websites has become an ever more important factor in how far up the Google SearchRank your page appears.
For this reason, Google’s own PageSpeed insights is a key tool commonly used by SEO specialists and marketers, since it gives direct access to the system through which the Google search algorithms assess page speed.
These considerations apply to WordPress just as much as they do to sites running on other platforms. Because of this, and due to the market dominance of WordPress, there are now several tools available to test the speed of your site. These range from one-off browser-based checks to fully-featured desktop software suites that will give you a detailed rundown of how every page on your WordPress site is performing.
Google Lighthouse and WordPress
One of the most important and popular tools for assessing the speed – and the general quality – of websites is Google Lighthouse. Up until quite recently, Lighthouse was used almost exclusively by developers and other techie types. But Google has worked hard to make it accessible for the average user, and it is growing in popularity as a speed testing tool due to the high level of automation it offers.
Lighthouse can be run against any page, whether it requires authentication or not, and whether it is running on WordPress or not. It will run a series of user-defined tests, and then generate a report on how the page performed.
These reports can then be used to improve the overall quality of your web pages, including their speed.
While you can run Lighthouse directly from Chrome DevTools, there is also a version of the tool that is continuously updated. This is known as Lighthouse CI, and will be the version of Lighthouse that more advanced users need.
CI, in this context, stands for Continuous Integration. This is a software development paradigm in which updates to software are continually uploaded to a central repository by developers, so users always have access to the latest version. CI is now standard in numerous web technologies and industries. For example, 43% of banking applications are programmed with COBOL, a CI-based computer programming language.
One reason why CI has not taken off everywhere is because there is still a widespread (and often ungrounded) assumption that it gives rise to major security issues. However the truth is that CI can lead to more secure software systems thanks to the practice providing automated security enforcement.
There are also many reasons to use Lighthouse CI to audit the speed of your WordPress site, but among the most useful are: that you can configure Lighthouse CI to run automatically every time your site is updated or changed. This can be done using a Lighthouse budget, where you can define a number of bespoke speed tests for different parts of your site.
Furthermore, you can even use this automated system to prevent changes that will slow down your site from being deployed to your (or your clients’) WordPress sites. This automatically prevents costly changes from impacting your PageRank score.
Using Lighthouse CI with WordPress
The process of setting up Lighthouse CI to run on your WordPress site is not complicated, but it is a little involved.
For those looking for a summary of the process, or who have a little more technical knowledge, here is the basic outline of the process:
- First, you will need to set up a new GitHub repository to keep track of the changes to your WordPress site. If you are testing the speed of your site on a regular basis anyway, setting up a repo like this is a great way to keep track of your site, whether you are using Lighthouse CI or not.
- Next, you will need to download Lighthouse CI, and configure it to look for changes. You can then build a Lighthouse action that runs automatically every time a URL is changed on your WordPress site.
- In order to build the function, you will need to create a separate Google Cloud Function that can update the Lighthouse CI action configuration with the recently changed URLs from the XML sitemaps, and then send the new configuration to the repository.
At this point, you will have an instance of Lighthouse CI running automatically on your WordPress site, and alerting you when your planned changes will make it slower. From here, you can even add automatic actions to your GitHub repo to prevent changes of this type being published to your site.
The best alternative to using Lighthouse CI to boost your WordPress site speed is to make use of speed testing tools that come built into your web hosting. The most common WordPress hosts, such as SiteGround or Kinsta, come with certain speed testing tools that claim to boost site speed by over 200%, and can also be used in conjunction with Lighthouse CI if you so choose.
Final Thoughts
Ultimately, the objective of installing Lighthouse CI on your WordPress site is to give you better oversight about how it is performing; it will not help you improve this performance.
If you are continually seeing pages exceed your Lighthouse performance budget, it’s time to take action. Read through our guides on how to optimize your WordPress pages, or you can even take the more drastic step of researching CDN services that can speed up WordPress.
Whichever approach you take, keep in mind the importance of speed to your website’s success. Make sure you are auditing regularly.
Hello, how to enbal Use Google Lighthouse in wordpress
If you just want to use Lighthouse right now (not setup the automated process as mentioned in the article) simply open up a Chrome browser window, go to the site you want to generate a report for, Inspect the page (on mac that’s option + command + c) and click on the Lighthouse tab. From here you can choose the mode, device and categories before analyzing your page.