Be prepared to big changes in GTM4WP v1.20
GTM4WP version 1.20 is set to be released on February 5th. I believe the most fitting title for this release would be “The Big Cleanup.” Get ready to removed features to ensure your measurement setup continues to function smoothly.
Numerous deprecated features
Over the past few years, GTM4WP has seen the deprecation of many features. However, only a handful were actually removed to support older WordPress and WooCommerce instances. This resulted in a significant amount of legacy code within the plugin. Version 1.20 will likely be the first release where the plugin’s size decreases—a positive development. With Google phasing out Universal Analytics for most users and completely discontinuing this legacy Analytics version in the next few months, it’s time to bid farewell to these deprecated features and make way for the future.
Removal of Universal Analytics-related GTM events
Arguably the most substantial change and a crucial item on the changelog that requires your attention. This removal was already announced in the v1.19 changelog.
Even if you’ve removed Universal Analytics related tags from your Google Tag Manager container, some may still rely on legacy data layer events and legacy ecommerce data. Do you have triggers using gtm4wp.orderCompletedEEC or gtm4wp.addProductToCartEEC? These events will cease to exist after updating to v1.20, potentially causing your existing tracking codes to stop functioning.
What can you do?
If you depend on legacy events, update your triggers to use different event names for the same purpose:
- gtm4wp.orderCompletedEEC > purchase
- gtm4wp.changeDetailViewEEC > view_item
- gtm4wp.checkoutStepEEC > add_shipping_info or add_payment_info depending on which step do you want to catch
- gtm4wp.addProductToCartEEC > add_to_cart
- gtm4wp.removeFromCartEEC > remove_from_cart
- gtm4wp.productImpressionEEC > view_item_list
- gtm4wp.productClickEEC > select_item
- gtm4wp.checkoutOptionEEC > add_shipping_info or add_payment_info depending on which step do you want to catch
If you use community tag templates relying on old event names or the old ecommerce data model, contact the template developer for an update. Since one of the most popular tag templates, the Facebook pixel created by the great Simo Ahava and overtaken by Meta is now abandoned, we created a new version of it that uses the new ecommerce data model to automate ecommerce tracking.
General advice for reading data from the legacy ecommerce model:
- Use ecommerce.value instead of ecommerce.purchase.actionField.revenue to access order revenue and the value of any ecommerce action.
- Use ecommerce.transaction_id instead of ecommerce.purchase.actionField.id to access the order ID.
- Use ecommerce.currency instead of ecommerce.currencyCode.
- Instead of ecommerce.<action>.products, use ecommerce.items for product data, taking note of updated product attribute names.
Setup guides have been updated for Google Analytics 4 and if you are still using the legacy tags, that guide was updated too.
Though never officially supported, if you or any plugins rely on internal function names in GTM4WP, many have been changed and reorganized. While this likely won’t cause issues for most sites, be prepared for the change. This reorganization also has a positive effect: ecommerce tracking is now poised for extension to other platforms, starting with Easy Digital Downloads, the most requested integration.
Removal of Google Optimize integration
Given Google Optimize’s discontinuation last September, this change is unlikely to impact your current marketing strategy.
Do not track browser flag
Some browsers still have an option allowing users to turn on a flag that JavaScript codes can read to optionally change tracking behavior. While not widely used and now deprecated in most browsers, more robust data protection mechanisms are available. GDPR in the EEA requires a different approach to obtaining and respecting user consent while activating tracking codes.
For a while, GTM4WP included the status of this browser flag in the data layer, but it has been removed, and it was rarely used.
Removed or updated filter names
This information is crucial for plugin and theme developers:
- Removed: deprecated filter GTM4WP_WPFILTER_AFTER_DATALAYER/gtm4wp_after_datalayer
- Removed: deprecated filter GTM4WP_WPFILTER_ADDGLOBALVARS/gtm4wp_add_global_vars
- Removed: deprecated filter GTM4WP_WPFILTER_GETTHEGTMTAG
- Changed: renamed WP filter gtm4wp_datalayer_on_pageload to gtm4wp_woocommerce_datalayer_on_pageload to better reflect when it is called.
Removed support for very old WooCommerce versions
GTM4WP has finally removed support for very old WooCommerce versions like 3.6 or older, given that the plugin is now over version 8.0.
New and updated features
If you are using a Consent Management Platform or a consent banner plugin that does not support Google Consent Mode, GTM4WP can now fire the ‘default’ command before the GTM container loads. However, the ‘update’ command needs to be triggered by you via GTM, likely by setting up a trigger for when the user saves consent choices or when the page loads with prior consent.
Another new feature is related to the Consent Mode update: codes have been added to integrate with the WordPress plugin WebToffee GDPR Cookie Consent. This provides a GTM event when users save their consent choices, with the event name being cookie_consent_update and a consent_data data layer variable including consent choices. You will need to translate this to the appropriate Consent Mode flags and fire a Consent Mode update command using a tag template.
With WooCommerce, you can now access the stock status of each product in the ecommerce.items array. This data can be registered as a custom dimension for further analysis based on that product attribute.
Download the beta and test it as soon as possible
The full release notes can be checked on GitHub, where you can also download the latest beta version. It is recommended to test the beta on a separate version of your live site to ensure it does not cause any issues during testing.
If you encounter any bugs, please open a ticket on the GitHub repository linked above.