Disclosure: Your support keeps the site running! We may earn a referral fee for some of the recommended services on this page. These are services we have tried or use. Learn more.
In today’s article I’m going to show you how to optimize your WordPress website’s page speed by hosting gtag.js locally. And fix the “leverage browser caching” problem in Pingdom and GTmetrix speed tests.
How to boost website speed in WordPress
It is undeniably true that site speed plays a vital role in your online success. Most especially for E-commerce websites. Google made this clear with it’s core web vitals update; which made page loading time a search ranking factor. The logic here is, faster page loads translates into better user experience and higher conversion rates. It’s no big secret at all, site visitors will leave if a page loads longer than necessary.
There are many ways of improving user experience in this regard. And one of them is to ensure that your site meets the recommended Core Web Vitals scores.
So, let us take a look at two ways to fix this.
Hosting gtag.js locally
As mentioned earlier, hosting gtag.js locally is one method that reduces the amount of time needed to load the Analytics code.
This is a strategy that Napeza uses to improve core web vitals scores. But, since only a few site owners know about this, here is how to add it to your WordPress site.
Before Hosting the Analytics script
You need to install and activate the following:
- MonsterInsights pro plugin. If you don’t have it, get it here.
- Ensure that MonsterInsights’s new Performance Addon feature is enabled.
MonsterInsights is currently the #1 Google Analytics plugin for WordPress.
Want to Add Google Analytics?
By far MonsterInsights has been our number one Google Analytics plugin for. for WordPress
MonsterInsights offers an unconditional money back guarantee of up to 14 days.
MonsterInsights via the performance feature. Allows you to host the gtag.js code on your server; without any need for a developer.
To use this feature, ensure that you are using MonsterInsights pro as stated above. Then in your WordPress admin menu, go to Insights >> Addons. Scroll to the bottom. On the Performance addon, toggle Add Gtag.js File Locally to blue. That’s it.
Once enabled, the Performance Addon feature will locally host and automatically fetch the latest Gtag.js file from Google every after 24hrs. This is to make sure it’s up to date. Or you can manually fetch for any updates to the file in between the automation circle.
Use an optimized Google Analytics plugin for WordPress
Other known factors that might affect your site loading speeds for users. Are your plugins, themes and other webhosting related issues.
Again, the only plugin you need for this is, MonsterInsights. The recent MonsterInsights update, version 7.18 now offers a faster script loading time for better Core Web Vitals scores.
All you need to do is install, activate and set up the plugin with your Google Analytics account.
MonsterInsights ranks as the best Google Analytics plugin for WordPress. Get it for free!
I hope you can now improve your site user experience using MonsterInsights new performance feature. You can further use the plugin to get user optimization insights and speed recommendations.