WordPress Guide: How To Boost Your Site Speed By Hosting gtag.js Locally
From May 2021, Google has released the Core Web Vitals in the factors it uses to determine a website’s ranking on its search engine?
So, your website needs to pass the test to rank on Google.
As you know, ranking on Google is very important because Google is the most popular Search Engine in the World. So, it’s no surprise that you’d want to rank higher on Google search results.
While it sounds stupid that a Google product can impact its own Core Web Vitals score, the Google Analytics tracking script can slow down your website and affect your score if it’s not optimized for high performance.
In this blog, I will show you how to host gtag.js locally, which helps you to increase your WordPress website speed.
For that, we are going to use MonsterInsights. MonsterInsights is the most popular and advanced Google Analytics plugin for WordPress.
Read my MonsterInsights review, to know more about it.
MonsterInsights has two pricing plans: Free and Paid. They offer three types of paid plans: Plus (99$/year), Pro (199$/year), and Agency (399$/year). Basically, the more you pay, the more advanced features you will get.
Recently MonsterInsights rolled out a new update (7.18), where they change their logic for how their main tracking script loads on your website.
This new update can load your website faster than before. They also update their Performance Addon to include the option to host your gtag.js script locally on your own server.
It can make your load time as short as possible by reducing the number of external resources your website has to load.
By default, Google Analytics has a two-hour cache time. But by serving the script locally, you can have full control across the caching of the file, which further reduces load time.
Also, MonsterInsights’ Performance addon will automatically fetch the latest gtag.js file from Google every 24hrs to make sure it’s up to date.
If you don’t know how to connect Google Analytics to your website using MonsterInsights, then read this article about how to connect Google Analytics and MonsterInsights.
What is the best web hosting for WordPress? – read this article and choose a web hosting for your WordPress website.
If you want to increase your website speed, then read this article about how to increase your WordPress website speed and also improve your site’s vital score.
That’s it. Please share this blog post with your friends and family. And if you have any doubts regarding this topic, feel free to comment in the comment section below. Thanks for reading.