Google Analytics page performance overhead

Google Analytics is a popular option for web analytics, but it’s important to understand how it affects your site’s performance.


Google Analytics is a popular and powerful tool that allows you to analyze audience behavior on your website. However, it’s important to understand how Google Analytics page performance overhead will affect the user experience on your site. In this post, we’ll explore how it impacts page speed load time, so you can make an informed decision to use it or find an alternative.

Why is Google Analytics so popular?

There is a lot to like about Google Analytics. It’s a free service loaded with features and is highly customizable. If you use other Google services, you can use a single “Google tag” to integrate those services with your website. It’s no surprise that Google Analytics owns about 75% of the web analytics market share in 2022, per Statista.

The hidden cost

Google Analytics (GA) adds quite a bit of JavaScript to your pages when you add their tags. This is also true for any WordPress analytics plugin that leverages GA. You might ask, how much is “quite a bit?”

To test Google Analytics, I installed the official “Site Kit” WordPress plugin by Google on my FireflyWP WordPress instance. Site Kit automatically adds the Google Analytics “tags” to your WordPress home page. To their credit, Google made the setup super easy.

I verified Google Analytics was set up correctly and recording traffic. I then opened my browser developer tools and fully reloaded the site. Here is a screenshot with all the Google Analytics requests outlined in red:

Site Kit combined with Google Analytics added over 130 kilobytes of JavaScript to my home page. This is hardly noticeable over a high-speed data connection but slows you down on a mobile device with cellular.

Google on Google Analytics

Google has an excellent tool called PageSpeed Insights to measure your page load performance. I used it to test FireflyWP with and without the Google Site Kit plugin activated. Here are the results:

Google Analytics Enabled

Google Analytics Disabled

When Google Analytics was added, site performance dropped 5%, and the page took an additional 300ms to load. Again, it’s alright if you have high-speed internet, but it will be an easily perceptible difference at lower data speeds.

PageSpeed Insights may suggest that Google Analytics is loading unused JavaScript on your page. This makes me chuckle a bit every time I see it:

Even Google seems to think Google Analytics is an opportunity to reduce your page load time! 😉

If you want to learn how to use PageSpeed Insights to diagnose other performance issues, you can read my WordPress Performance Part 1 article here.

Alternatives

There are alternatives if performance is important to you and you’re willing to pay for an analytics solution. As a bonus, they are privacy-first and GDPR-compliant. The cons are they cost money and won’t be as full-featured as Google Analytics.

Simple Analytics

Simple Analytics supports event tracking “without tracing individuals.” Their script is only 3Kb which is a fraction of the size of the Google Analytics JavaScript. The user interface is simple, and they offer a WordPress plugin for easy integration.

Plausible

Plausible is super lightweight with a JavaScript footprint of less than 1Kb. Like Simple Analytics, they also provide a simple user interface and WordPress integration via a plugin. I have been using Plausible on this site for a few weeks now, and the performance overhead is imperceptible to PageSpeed Insights. When I turn Plausible on and off, there is no change in the performance score.

I am happy with the stats Plausible provides:

  • General visitors and pageviews
  • Where visitors are coming from
  • Top pages
  • Locations
  • Devices

I think that’s good enough.

In addition, you can set up custom events to track when a user performs a specific function, like submitting a form or making a purchase. You can implement events by adding special classes to your buttons and other elements or trigger them directly using JavaScript. The Plausible documentation covers all of this here: https://plausible.io/docs/custom-event-goals

Plausible is open source, so you could self-host it if you wanted to. BTW, no, I don’t get any kickbacks for recommending Plausible or Simple Analytics.

Conclusion

If site performance and privacy are important, you have alternatives to Google Analytics. Did I miss any other lightweight web analytics services? Let me know in the comments below!


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *