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…
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.
As of v3.9.0 CAOS offers support for Stealth Mode combined with GA4!
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.
https://daan.dev/docs/caos/configure-caos-with-google-analytics-v4/ [edited URL]
ARTICLE TITLE NOT FOUND.
Hi, that links was incorrect! Thanks for notifying me, I’ve updated it. However, the contents of the article are still not found :-/ I have to look into that. Thanks again!
Still, there is no article available.
I know. I haven’t been able to fix the issue. I recently switched Documentation hubs, but for some reason this document isn’t loaded properly.It’s fixed now!
After uninstalling CAOS, a whole line disappeared from my Analytcis code
I have no idea what’s going on, the hooks in Astra pro contains this line, it’s missing in the site code and Analytics has stopped collecting data :((
Could you contact me using the contact form on this site, and provide your site’s URL and a screenshot of the issue?
Sorry for the confusion, I’m a noob, one of the ad blockers was running in the background…Everything is ok, I will return to test with your plugin, I think it is worth it!
I also had a similar problem to Michał. Also, when testing how one of the ad blockers worked, I had the impression that something was wrong. A few clicks and everything works. CAOS is one of the most interesting solutions. Thanks.