The new release of GTM4WP adds another boost for your WooCommerce store. One of the most waited features was the support for WooCommerce Blocks. But there is a substantial change for developers of modern websites too. GTM4WP does not need jQuery anymore, and there is even more!
Supporting WooCommerce Blocks
More webshops built using WooCommerce are using Gutenberg blocks instead of shortcodes to customize the homepage and other parts of the site. GTM4WP did not track product lists added using WooCommerce Blocks properly with the product list impression and product list click enhanced ecommerce action. But this is not the case anymore. All product list blocks, except for the “All products” block, GTM4WP will add the necessary code to track those product lists as well.
Catching even more purchase data
One of the most mentioned headaches on the support forum is that merchants do not see all orders in Google Analytics. There are so many reasons why Google Analytics can not track a transaction . It would be so great to eliminate all one by one but there are some reasons that cannot be fixed.
One reason is that merchants use other plugins or theme option that alters the default thank you page. Sometimes there is a minor change, sometimes a completely new page appears to users. WooCommerce executes lots of functions using the default order received page. Plugins like GTM4WP can attach to those functions to extend behavior. If a custom thank you page plugin does not mimic those functions, tracking with GTM4WP could break.
v1.14 introduces an additional tracking method that might better work with most custom thank you page plugins. Technically next to relying on the is_order_received_page() template tag, it will also hook into the woocommerce_thankyou action and output purchase data only if the first method was not called.
Support for new customer conversion reporting in Google Ads
Google Ads has a nice feature that allows you to maximize conversion value for new customer acquisitions. To setup this feature you will need to use a dedicated conversion code in Google Ads instead of importing goals and transaction from Google Analytics. With that, you can tell Google Ads that the reported conversion is coming from a new customer. This allows Google Ads to adjust the conversion value and optimize your Shopping campaigns to have more new customers.
Privacy, yet again…
Especially as 3rd party cookies are getting phased out, advertising systems rely more on 1st party data. If you have the email address of your customer or lead (not just in WooCommerce), and you also have the consent to use this as an ID in online advertising, it can be useful for either exclude this user from further advertisement or to build a similar/lookalike list to expand your reach using your own data.
Sending an email address to any ad platform needs strong privacy measures. Besides asking for proper consent from the user, it is also important to encode the email address before sharing it with an ad network. This is important in order to prevent the ad network to gain additional personal data if the email address is not stored within the ad network yet. Encoding here means the data is transformed into another value that cannot be decoded by anyone. But encoding is deterministic, meaning that encoding the same data again will give you the same result every time. We call these algorithms: hash algorithms. And when it comes to hashing email addresses, the currently used and accepted coding method is SHA256.
GTM4WP now includes SHA256 hashed versions of email addresses in the data layer. WooCommerce users can read the customerBillingEmailHash variable, in other, more generic cases you can use the visitorEmailHash variable if three is a logged in user on your website.
Another privacy related change is that GTM4WP uses less cookies from now: gtm4wp_product_readded_to_cart cookie was removed. The cookies gtm4wp_user_logged_in, gtm4wp_user_registered and gtm4wp_last_weatherstatus are now HTTP only cookies. Hopefully, those changes will give you better options to build privacy safe websites.
Good-bye jQuery, at least for non-WooCommerce sites
Another much-requested change was around the usage of jQuery.
For non-developer readers of this post, let me quickly summarize what jQuery is. In order to understand why this library is so important, you need to jump back to the days when Microsoft Internet Explorer 6 was the dominant browser and Google Chrome was in its very first days. IE6 was a real nightmare for website developers since it did not support many web standards. When developers created websites using those standards, they had to add additional codes to make them work with Internet Explorer too.
And then, jQuery was born. It allowed web developers to create codes that work on both modern web browsers and on Internet Explorer without the need to take care of the vendor. jQuery did the check and executed all codes in a way that ended up with the same results in every browser.
In 2021, almost all web browsers support web standards in the same way. Though there are still some differences, web developers can omit jQuery in most cases. And as web apps evolve, using jQuery could also hinder site performance. It is not our duty to tell you whether jQuery is great or bad nowadays. But it is important to admit that there are more cases when developers can eliminate jQuery.
Well, yes. If you are using WooCommerce, you will still be using jQuery as WooCommerce itself relies on jQuery a lot. There is a long thread on GitHub where WooCommerce developers expressed it explicitly that removing jQuery dependency is not a priority on the roadmap. And with that, GTM4WP still needs to use some jQuery code if you are using WooCommerce. But that code will only load if WooCommerce and ecommerce tracking is enabled.
And that is not the end of the list
GTM4WP v1.14 includes many fixes and updates that will make this plugin yet again more compatible with all browsers and other WordPress plugins.
What is next?
There are already some requests that are scheduled for v1.15, but this list will be revised in January.
Until then: Merry Christmas and a Happy New Year for everyone!