For the past few weeks I’ve been working on my WordPress site in an attempt to reach 95+ on Google PageSpeed Insights.
I thought it would be easy. “All I need to do is make a few tweaks here and a few optimizations there,” I told myself. “Smush my images and set expire headers; install W3 Total Cache and all will be sweet. A piece of cake.”
How wrong was I.
The closest I got was 91. Just four freaking point away! I facepalmed and tried again. And again and again and again with different hosts, themes, plugins, tweaks… But no matter what I tried I couldn’t reach that elusive 95.
Still, 91 ain’t so bad, right? It’s certainly a step up from the 74 I started out with.
In this post I’ll go through the various measures I put in place on my test sites to achieve a score of 91/100 on PageSpeed Insights.
Before we get started, let’s go through the results.
After experimenting with various web hosts, themes, plugins and code, I achieved my highest score with WP Engine using the Frank theme. As WP Engine bans the use of W3 Total Cache, I was unable to use that plugin but was able to use other plugins, such as Autoptimize, Minit and Remove Query Strings From Static Resources.
Unfortunately, I was only able to reach 79/100 for mobile. My goal was to reach a desktop score of 95+, so this post will focus on the measures I used to try to achieve that.
My final score on Pingdom Website Speed Test:
My final score on GTmetrix:
Why Site Speed is Important
When someone lands on your site, you only have a few seconds to grab their attention and convince them to hang around and not bounce.
Quality content and a good-looking theme are important, but if your page loads slowly, you could lose people before they even get a chance to see your content.
According to Kissmetrics, nearly half of web users expect a site to load in two seconds or less, and they tend to abandon sites that don’t load within three seconds. A total of 79 per cent of online shoppers who have trouble with site performance won’t return to the site to buy again and about 44 per cent of them would tell a friends if they had a poor experience shopping online.
While site speed is one of more than 200 signals Google uses to determine search rankings, and fewer than 1 per cent of search queries are affected by the site speed signal, it’s conversions that you need to worry about. A fast site will give your visitors confidence in your product or service and convince them to hand over their cash.
What is Google PageSpeed Insights?
Google PageSpeed Insights is a
frustrating handy tool that analyzes your site’s front-end performance and offers optimization suggestions.
It scores your site from 0 to 100 points, with a score of 85 or above indicating a page is performing well.
PageSpeed Insights measures who a page can be improved based on:
- Time to above-the-fold load: Elapsed time form the moment a user requests a new page and to the moment the above-the-fold content is rendered by the browser.
- Time to full page load: Elapsed time from the moment a user requests a new page to the moment the page is fully rendered by the browser.
Testing your site with PageSpeed Insights can be an eye opener for anyone who hasn’t bothered to optimize their site, and also offers a great starting point for those looking to improve site performance.
Having said that, it can also send you into an unnecessary panic when a site returns lower than expected scores, or suggestions that counter measures you have put in place on your site.
Trying to Get 95+ on Google PageSpeed Insights
So let’s go through some of the measures I tested on my test sites.
Benchmark Your Site
First thing’s first: benchmarking.
PageSpeed Insights is just one popular speed test site. In order to get a more rounded view of how my test sites performed, I also used Pingdom Website Speed Test and GTmetrix each time I put a new measure in place.
My first test site was a fresh WordPress install with Bluehost, complete with imported theme test data, the Twenty Fourteen theme and various plugins you might find on a typical WordPress install, such as Akismet and Jetpack, as well as contact form, SEO and Google Analytics plugins.
My first pass at PageSpeed Insights returned:
My first pass at Pingdom Website Speed Test returned:
My first pass at GTmetrix returned:
Choose a Fast Web Host
PageSpeed Insights looks for a server response time under 200ms, so if you’re on a shared server you’re going to struggle with this one.
A cheap web host offering monthly plans for $3.95 complete with unlimited page views and unlimited space might seem like a bargain, but the trade off is usually slow site speeds and frequent down time during high traffic periods.
If you want your site to be lightning fast and ensure your site performs well, you need to invest in a decent web host. If you really want your site to be site, you may want to look at hosting packages that aren’t on a shared server.
For advice on web hosts, check out our web host review series and find out who we named the best web host.
I set up my initial test site with Bluehost. Yes, I know, Bluehost isn’t exactly well-known for its speed. The slow server response when I tested the site reflected as much:
I set up an identical site with Dreamhost. The speed was so absolutely abysmal I couldn’t even load the site most of the time, forcing me to look to other hosts.
I also tested VentraIP, an Australian web host, which returned similar results to Bluehost.
But the test site I had the most success with was hosted with WP Engine, a managed hosting service for WordPress. I was able to achieve a server response time below 200ms.
Use a Good Caching Plugin
Caching your content can dramatically improve your site’s load times. W3 Total Cache is by far the most popular caching plugin available with almost 3.5 million downloads. It offers browser, page, object, database, minify and content deliver network caching support.
It’s easy to set up, but if you run into any trouble WP Beginner has a great guide on how to configure the plugin.
Optimize Your Images
High resolution images take much longer to load than optimized images, and unnecessarily large files can drastically slow down page speed.
WPMU DEV offers a fantastic (free!) plugin called WP-Smush.it. When you bulk smush images with this plugin, you’ll find the size of your images will be hugely reduced without compromising visual quality.
While we’re on the topic of images, lazy loading images can also improve page speed.Check out my review of 6 Lazy Load Plugins to Make Your WordPress Site Faster for plugin recommendations.
Sign up for more
Optimize Your Homepage
There are some easy ways to further speed up your site:
- If you publish blog posts on your homepage, publish only excerpts or summaries and reduce the number of posts to five or less.
- Keep widgets to a minimum. Only use widgets that are absolutely necessary.
- Remove inactive or unnecessary plugins.
Overall, a clean and focused site design will help your page not only look good, but load quicker as well.
Choose a Fast and Lightweight Theme
I found the Twenty Fourteen theme offered more features than In need on my site so I went in search of a simple, minimalistic theme. I found Frank, a theme designed especially for speed.
The parent’s theme’s default homepage makes nine database queries and consists of just two HTTP requests, weighing about 29kb.
After installing Frank theme, the number of HTTP requests needed to load my site reduced from 31 to just four.
Remove Query Strings
This is a problem as many proxies will not cache the resources if it has a query string in the URL.
There are a couple of simple ways to remove query strings:
- The Remove Query Strings From Static Resources plugins removes any query strings from CSS and JS files and promises to improve your speed scores for services like PageSpeed Insights, Pingdom and GTmetrix.
- Developer Paul Underwood also offers a great guide to removing query strings with code on his snippet site.
I successfully tested both methods, but found the plugin was more convenient as I didn’t have to meddle with code and I could quickly activate and deactivate the plugin.
Minify and Combine
After installing this plugin the PageSpeed Insights stopped prompting me. Problem solved.
Gzipping your site can load your pages faster and reduce the size of your files by up to 70 per cent.
There are several ways you can enable Gzip on your site:
- W3 Total Cache includes an option to enable Gzip. Go to Performance > Browser Cache > General.
- Edit your .htaccess to enable Gzip. Just add the following to your .htaccess file:
Thanks to Softstribe for the above snippet.
- Use a compression plugin. WP-HTML-Compression and GZip Ninja Speed Compression are both fairly popular Gzipping plugins.
I found W3 Total Cache worked fine on my test sites, though for the WP Engine site I didn’t use Gzip as WordPress Gzip Compression is a disallowed plugin.
Optimize Your WordPress database
Keeping your database tidy and in order can help keep your site running smoothly, especially if you’ve been experimenting with and deleting plugins and have unnecessary database entries.
There are a couple of plugins that can help you do this:
- WP-Optimize comes with many options for extensively cleaning up your WordPress database and optimizing it without doing manual queries. It can remove spam and un-approved comments, empty the trash, remove trackbacks and pingbacks and can run automatically.
- WP-DB Manager allows you to optimize your database, repair it, back it up, restore, delete backup, drop/empty tables and run selected queries. This plugin also supports automatic scheduling of backing up, optimizing and repairing of database.
I found WP-Optimize was easy to use and offered more functionality than WP-DB Manager.
Use a CDN
If you’re serious about speeding up your site, you may want to consider signing up to a content delivery network (CDN).
A CDN will drastically reduce server lag by storing static resources on a network of fast loading servers. We use one for the WPMU DEV site.
The only drawback with using a CDN is that it can decrease your PageSpeed Insights score… which is, obviously, counterintuitive to anyone seeking to improve their site’s performance.
The reason for this lies in PageSpeed Insights’ front-end-only analytics.
It could also be that the CDN sets a cookies and your code is no longer hosted on a cookie-less domain, also bringing down your score.
So what’s the benefit then of having a CDN? While fast scores aren’t reflected in PageSpeed Insights’ front-end scores, a CDN is still a valuable tool in improving backend site speed, which PageSpeed Insights doesn’t analyze.
I admit defeat. A total score of 91/100 is the highest I can achieve on PageSpeed Insights.
Yes, attempting to beat the system made me frustrated and maybe even a little batty, though overall I learnt much.
There are many measures, all outlined above, that you can put in place on your site to improve its performance.
PageSpeed Insights, while maddening, offers a good indicator of whether you are on the right track when attempting to speed up your site.
Similarly, Pingdom and GTmetrix shouldn’t be ignore. Both offer helpful insights and more detailed information on how you can improve performance.
If you want to score highly, it’s best to experiment with a range of measures and see what works best for your site and server setup. After all, every situation is different.
What score does your site get on Google PageSpeed insights? What measures did you put in place to achieve it? Tell us in the comments below.
Image credit: xmodulo.