How To Use GTmetrix To Speed Up Your Site


bwf
How To Use GTmetrix To Speed Up Your Site

GTmetrix is an awesome free tool that we’ve been using for a while now to assess how you can speed up your site by following their simple recommendations and tweaks. It uses Google’s Pagespeed and Yahoo’s Yslow services to test websites and then outputs the results with a A-F grade and lists the the main issues slowing your site down along with recommendations to improve that.

The best way to explain it is really to run through the whole process from start to finish.
Let’s take a sample e-commerce WordPress website, run it through GTmetrix and see what kind of grades we get.

http://gtmetrix.bwf.co is our sample WordPress + WooCommerce site (which for security reasons will be removed after our testing)

Step 1: Analysing The Site

Starting-Grade

Step 2: Browser Caching & Gzip Compression

As you can see we get an F and a C to begin with along with a detailed list of what we need to do. Let’s start by fixing the ‘Enable Gzip’ and ‘Leverage Browser Caching’

We can actually do that with one .htaccess file in your ‘public_html’ folder. Below you’ll find a downloadable .htaccess file with browser caching and gzip enabled which you can upload to your hosting account. Alternatively if you prefer to add the code manually it’s listed below:

Screen Shot 2015-10-30 at 15.01.55

Enabling Gzip

Screen Shot 2015-10-30 at 15.03.10

Enabling Browser Caching

Step 3: Improving Other Elements

Improved-1

Now we come to one of my issues with GTmetrix. The better your grade becomes, the harder it gets to get that ‘A’ grade. New elements will appear that weren’t there before as you fix other issues. As you can see from the screenshot we now get an ‘F’ grade for ‘Remove query strings from static resources’

It’s common practice for developers to add a ‘query string’ on to the end of resource URLs to avoid those files being cached in the browser. For example, “http://gtmetrix.bwf.co/wp-content/themes/betheme/style.css?ver=9.7” You can see the, “?ver=9.7” on the end. The purpose of that is to avoid being cached until that version number changes. That way developers can make changes to files, update the version and not have to worry about users loading an old version of the file.

Luckily if you’re running WordPress like we are on our test site, there’s a plugin for that! Simply install, ‘Remove Query Strings’ plugin from here.

So the next issue we have to fix is “Serve scaled images”. It suggests we’re using images that are much larger in size than we actually need them to be. It also gives locations of where those images are. The simplest way to go about fixing that is to download each of the images it mentions, resize it to the dimensions suggested by GTmetrix and then re-upload it.

Step 4: Re-run the test

Screen Shot 2015-11-02 at 11.22.26

We’re up from an ‘F’ and a ‘C’ to an ‘A’ and a ‘B’!

It’s worth noting that the ‘B’ grade in Yslow is due to not using a CDN (content delivery network) to serve static assets such as images, CSS and JS files.
This generally can’t be added for free and of course Yslow recommends the CDN provided by Yahoo!

Related Articles

Third Party Software

How To Install OpenVPN on a BWF Server

In this tutorial we will teach you how to set up an OpenVPN server on Ubuntu 12.04 server edition. The first step is to purchase a Ubuntu server from our website. Talk to our...

Posted on by bwf
Third Party Software

The Best FREE Uptime Monitoring Tools

Monitoring your server / website uptime is very important for any user and here at BWF we have an internal monitoring system that alerts our staff to any outage on our...

Posted on by bwf