How to Easily Boost Site Speed By Hosting gtag.js Locally

Written By Tech in the Sun

Blogging Tools

This page contains affiliate links to products. We may receive a small commission for purchases made through these links while your purchase price stays the same.


Did you know that every second counts? This is even more true when we talk about web performance.

Speed is important for all websites. Speed means how long a visitor takes to see your web page. It doesn’t matter if you are selling a product, having a booking service, or offering some service online; if the website is slow, visitors won’t stay long enough to see all the good things you have to offer.

If the website takes too long to load, people will be frustrated and may leave. This is also a factor in ranking websites well in search engines like Google.

If you’ve heard about the Google Page Experience update, you might wonder how it can impact your website. And if you use the Google Analytics tracking script to monitor your website traffic, you need to know that this script may affect your website performance.

To solve this performance issue, website owners should host the gtag.js script locally on their own server. Even if you don’t know how to do that, there is a ready-to-use solution offered by the MonsterInsights plugin.

What is MonsterInsights: its role in enhancing website speed

MonsterInsights is undoubtedly among the top WordPress plugins to consider for growing an online business, whether you have a blog, a news site, or e-commerce. Indeed, this analytics plugin helps you make the right decisions for your online business and accurately analyze your site without leaving your WordPress dashboard!

Host the gtag.js script locally on your server

With the MonsterInsights 7.18 release, the plugin now includes in the Performance Addon the option to host the gtag.js script locally on your own server. This will reduce the number of external resources your website has to load. This way, it helps to achieve the standards requested by the new Core Web Vitals.

Moreover, every 24 hours, it will fetch a new version of the gtag.js file from the Google servers. This ensures that you will always have the latest code.

MonsterInsights Performance Addon

So, if you use Google Analytics and want to speed up your website with a simple click, try the MonsterInsights plugin.

MonsterInsights is not just another plugin. It’s a tool that can transform your entire website and influence conversion rates. The price is much lower than you could expect, and along with it comes a 14-day, no-questions-asked refund policy. The free Lite version is available at no cost but has limits on some features and support. The Plus version is suitable for small businesses and costs $99 annually.

Find out all the licenses here.

Do you want to know more about how to switch from the old Google Analytics tracking code analytics.js to Global Site Tag gtag.js on WordPress? Have a look at the blog post How to install gtag.js Global Site Tag on WordPress