GTM4WP 2.0.6 is out
GTM4WP 2.0.6 fixes missing WooCommerce purchases from Facebook and Instagram in-app browsers on Android, and sends search terms and titles as plain text.
GTM4WP 2.0.6 is out on wordpress.org. It is a bugfix release for the 2.0 line, and two of its changes may need your attention: WooCommerce stores now get their purchases from the Facebook and Instagram apps on Android again, and two data layer values changed format, which can affect your GTM triggers. The update reaches your dashboard a few hours after the release, because wordpress.org runs an automated security review on every plugin release before it is offered as a one-click update; if you do not want to wait, you can download it from the plugin page right away. The complete list of changes is in the GTM4WP 2.0.6 changelog.
Missing purchases from Facebook and Instagram on Android
When a visitor opens your store from a Facebook or Instagram post or ad on Android, the page loads in the app’s own built-in browser. That browser adds an X-Requested-With header to every request, with the app’s name as its value. GTM4WP used this header to recognize background (AJAX) requests and checked only whether it was present, not what it contained. So for these visitors the plugin left out the whole WooCommerce data layer, including the purchase event on the order received page. The same apps on iOS do not send the header, which made the gap easy to miss: in GA4 it looked like paid social campaigns with very few conversions.
From 2.0.6, a request counts as AJAX only when the header value is XMLHttpRequest, so visitors in these in-app browsers are tracked like everyone else. If you added the must-use plugin workaround from GitHub issue #477, you can remove it after the update.
Check your GTM setup: siteSearchTerm and pageTitle
siteSearchTerm now carries the search term exactly as the visitor typed it. The classic data layer used to HTML-encode it, so a search for Shirts & Ties arrived as Shirts & Ties, while the cache-safe data layer already sent the plain text. pageTitle now carries the title as the visitor reads it on the page; WordPress’s own encoding of ampersands, quotes and dashes (such as & and ’) is decoded.
Most containers need no change. If a trigger or variable in your container compares one of these values with the encoded form, change it to the plain text after the update.
Other fixes
The release also fixes several smaller WooCommerce tracking issues, among them the classic cart’s Undo link, Mini-Cart tracking, Product Bundles stock status and thank-you pages in page caches. You find each of them in the changelog.
Thank you to sw33tr for the detailed report on the in-app browsers, which came with the cause and a proposed fix, and to KingWehsops for reporting the Product Bundles issue.
Please report problems in the support forum on wordpress.org or on GitHub.
