CAOS now supports Google Analytics 4: Here’s all you Need to Know

2020 was a big year for Google. Halfway they published a major upgrade for PageSpeed Insights and near the end of the year the Search Giant released v4 of its Analytics API, introducing a bunch of new features.

Lots of CAOS users were eagerly waiting for me to publish an update. Granted, it took a while, but it’s here now! And I appreciate your patience. Let’s take a look at what we got here, and more importantly, how to set it up!

Interlude

I can’t begin my first post of the new year, without wishing you all the best, perfect health and happiness to you and yours. Although it was a big year for me, 2020 was a terrible year for lots of us. I hope 2021 will turn this around. For all of us.

Do a search for Google Analytics 4 features and you’ll be flooded with SEO/SEA marketeers explaining the key features of Analytics’ API update:

  • Smarter, AI-powered insights and predictions,
  • Deeper integration with Google Ads,
  • And so on.

I was more interested in the technical/performance aspect of this update: what do all these new features mean for your site’s performance? I.e. how does it perform compared to its older siblings, analytics.js and gtag.js?

Technical Breakdown of Google Analytics 4 library

First off, Google Analytics’ V4 API is incompatible with analytics.js and can only be used with Global Site Tag (gtag.js) or Google Tag Manager (gtm.js).

This means that the relatively small Universal Analytics library (analytics.js: ~46KB) is replaced in favor of gtag.js, which weighs in at about 130 KB.

What I do like about the new Web + App property (gtag.js) is that it’s no longer a wrapper for analytics.js i.e. it no longer needs to load analytics.js in order to properly track visitors. This makes it feel a little less bloaty.

It’s still almost triple the size of analytics.js, though…

  • The Wait is Over.

    Get the Newsletter you've always wanted, now!

    Sign up to receive Biweekly, Free Optimization Tips for WordPress.

    No spam. I promise.

  • Will CAOS’ Stealth Mode support gtag.js?

    Because it’s no longer a wrapper for analytics.js, I can (carefully) say: Yes!

    No promises, though, because I haven’t finished my research yet, but till now, I haven’t met any issues while running my tests.

    The ‘old’ gtag.js is marked deprecated since CAOS v3.8.0 and will be removed in a future release. I.e. Google Analytics V3 users should either stick with analytics.js, or consider upgrading to V4 and use the new gtag.js.

    Setup Google Analytics 4 (GA4) in CAOS

    Since v.3.8.0 CAOS offers out-of-the-box support for Google Analytics 4. Setting it up is easy and involves a few steps (mostly in your Google Analytics dashboard).

    Refer to the Google Analytics 4 section of CAOS’ Documentation for a full step-by-step instruction on how to setup GA4 in CAOS.

    Summary

    Today we’ve taken a short look at Google Analytics’ new and improved V4 API. We concluded that although the gtag.js library is bigger in size, compared to analytics.js, it does offer some improvements over the old library.

    Daan van den Bergh

    Daan van den Bergh is a carefully seasoned web developer.His methods consist of thinly slicing your website’s beef and serve you with a platter of the best performance carpaccio on a bed of rocket — the only thing he’s more passionate about is food. Hire him at ffwp.dev.

    Leave a Comment

    This site uses Akismet to reduce spam. Learn how your comment data is processed.