I've been busy with this for quite some time. But the work is done - as part of a bartering deal with MaxServ. The Yireo GoogleTagManager extension for Magento 2 has now been refactored big time, with support for GA4. Here are the details.
A refactoring, needed for a long time
The Yireo GoogleTagManager extension has existed already for quite some time. Version 0 was released in 2016 already as an experiment under Magento 2.0. But only in 2019 the experimental stuff was cleaned up and major 1.0 saw the daylight. With that, Magento 2.2+ was required, which also justified the major jump. Then again, there was another major release (2.0) in 2020, to change the way that Magento
customerData was dealt with - instead of adding its own
section, the extension started to reuse the existing ones.
In the mean time, the extension became quite popular even though it lacked a lot of features: There were no click events, there was extensibility but only for experienced developers. And there was a lack of GA4 support. Time crept up upon me though: UA/EE (aka GA3) will be removed this summer, so I felt that either needed to give up or refactor the extension big time. This became major version 3.
GTM 2, version 3, GA 4
The numbers are a bit confusing: Because of an old GoogleTagManager extension for Magento 1, the Magento 2 version of the extension was named
Yireo_GoogleTagManager2. And now version 3 of that number 2 extension is out with support for Google Analytics version 4 (in short: GA4).
But it is not just GA4 support: The new extension also adds click events (product view clicks, add-to-cart clicks), full support for the checkout (all default GA4 events are implemented), an extensible architecture (via DI types or the XML layout) to extend things like product details. And a great bunch of debugging options - advanced browser console logging, logging to files and click debugging. All in all, the new release is packed with new features and definitely makes the entire extension more mature.
And it is free.
Another cool part is that earlier the Yireo GoogleTagManager extension v2 got support for the modern Hyvä frontend, via a third party compatibility module. But now, the support is built-on (and covered me). Even better, the first tests with the beta-version of the MageWire Checkout also shows that this works out-of-the-box (even though it requires a bit more work to make sure all events in the checkout don't fire on the checkout but in real-time, so full MageWire JS support is still pending).
The new version 3.0 is a major upgrade: This requires first of all a composer change - either by manually editing the root
composer.json file or by running
composer require yireo/magento2-googletagmanager2:^3.0 --no-update. And with that major upgrade, Magento 2.3.7 and/or 2.4.1 also became a minimum requirement.
On top of this, the settings within the Google Tag Manager console and the Google Analytics dashboard also need to be changed. An in-depth guide github.com/yireo/Yireo_GoogleTagManager2/blob/master/TUTORIAL.md should help people out with this.
Check it out
The new version has been available already for some weeks now, but if you haven't, do check it out via github.com/yireo/Yireo_GoogleTagManager2 and let me know what you think.