Below are the techniques that I have applied to improve my site performance:
- USE A SPEED OPTIMIZATION PLUGIN
In my opinion, this should be the first step towards speed optimization, there are a no.of good plugins available that can give you a jump-start towards the optimization process, I would personally recommend the well-known WP Rocket for its ease of use and reliability. You can quickly get started with the plugin configuration by simply downloading my settings of WP Rocket and importing it inside your Settings -> WP Rocket -> Tools -> Import settings.
Don’t forget to exclude the dynamic pages like checkout and user progress from Advanced Rules -> Never Cache URL(s)
If you need more details about the configuration of WP Rocket head over to this detailed guide.
- OPTIMIZATION INSIDE .HTACCESS FILE
The WordPress installation directory contains a file named “.htaccess”, open the file and add the snippet below. Setting expire headers enables the web browsers to cache the static files for faster delivery on subsequent request and GZIP compression allows your web server to provide smaller file sizes which load faster for your website users.
- OPTIMIZE IMAGES ON YOUR SITE
An important step to reduce your page size and loading time is to optimize the images on your site. The images that are displayed on WordPress pages should be optimized for use on the web. You can use either of these 2 plugins Imagify or Smush to reduce the image size and optimize it for better performance.
- USE A CONTENT DELIVERY NETWORK (CDN)
When a user visits a webpage, all the assets of that page are loaded from the hosted server, more than often visitors are distributed across different regions and as the distance of the user and server’s location increases, it takes more time for the user’s browser to fetch the page assets from the server. To overcome this issue a CDN is used which has a distributed network of servers and it loads the assets from the nearest available server based on the user’s location. CDN includes other performance benefits as well. I would recommend using the free Cloudflare CDN. After you signup, enable it from WP Rocket -> Addons -> Cloudflare and then add your Cloudflare details here,
- USE ASSET CLEANUP: PAGE SPEED BOOSTER
The fewer scripts & styles you load on your page, the lesser will be your page size and the better the performance. Often, there are no.of assets(JS, CSS, and images) loaded on a page that are unnecessary and can be removed to reduce the page size. Asset CleanUp is a very handy tool to unload(remove) particular scripts and styles from a page that are not used. It can also unload them globally for all the pages. However, this must be done with care as unloading a script or style that is used on a page could break your site. Here is a detailed guide for more on this.
- OPTIMIZE THIRD-PARTY INTEGRATIONS
This was the toughest part of the optimization for me! The reason being that one does not have any control over the third-party scripts and styles coming from an external application. This may include Google Adsense, Google Fonts, Google Analytics or Hubspot CRM, etc. These third-party integrations add all sorts of scripts and styles on your page which can massively increase the page size and loading time. At least, this was the case for me.
- OPTIMIZE GOOGLE ANALYTICS
Google Analytics is a web service that tracks and reports website traffic. They provide a tracking code that needs to be added to your website’s header to enable tracking. The problem with directly adding this tracking code to your site is, the scripts loaded by Analytics are not cachable in the user’s browser and this degrades the performance of the webpage as it needs to be fetched on each subsequent request. A workaround for this problem is to use a plugin called COAS. This plugin loads the Analytic’s script locally and enables leveraging browser cache.
- ALTERNATE OF GOOGLE ADSENSE
Google Adsense can be used to show automated ads on your website through the Adsense’s platform. They also provide you with a tracking code that can be added to your site. Personally, I think that automated ads option is too intruding and the third party scripts that are loaded by the tracking code, increase the page size and degrades performance. A better alternative of Adsense can be affiliate marketing ads that do not require any tracking code and scripts that could slow down your site. You can read more about this here.
- LIVE CHAT INTEGRATION
A live chat option, increases engagement and makes it easy to communicate with your audience. I used the Hubspot live chat widget through a tracking code on my site. This was the single most integration that was killing my page speed by loading all sorts of third party scripts. Unfortunately, there is very little that you could do with a third-party integration and I had to try a different live chat option and remove Hubspot altogether. The results were remarkable! I was able to drastically improve my page speed by using Tawk.to as an alternate because it only adds a single, light weight JS file to enable the live chat option.
Lastly, I would emphasize on:
- Optimizing your on-site assets (JS, CSS, Fonts & Images) using the techniques above.
- Being selective and cautious about the plugins you are adding to your site as it could impact your site performance.
- Being extra careful with the third-party integrations that you add because a single integration can drastically increase the size and loading time of your page.
Speed optimization can be frustrating and time taking job because it needs a lot of testing and fine-tuning to find the perfect configuration specific to your site for optimum performance. It’s possible that a technique or configuration which works for one site may not work for another because optimizations have to be adapted according to a specific site and environment. If you don’t have command over the technical aspects of these things, then better go for an expert to handle this tricky job for you & save you from a lot of hassle. You can also reach me out if you want my help with speed optimizations on your site!
I would love to hear your thoughts and suggestions, please comment below.