Troubleshooting Unclickable Product Links and Browser Back Button Issues in GTM4WP
Content
Many users of the 'GTM4WP – A Google Tag Manager (GTM) plugin for WordPress' have reported a specific and frustrating issue: product links on WooCommerce shop or category pages become unclickable, particularly after using the browser's back button. This problem is most frequently observed in Safari but can also occur in other browsers like Firefox. The issue is almost always linked to the plugin's Enhanced Ecommerce tracking features.
Why This Happens
The root cause is a known conflict between the JavaScript code injected by the plugin for tracking purposes and the way some themes handle click events and browser history. When the Track enhanced e-commerce option is enabled, the plugin adds a hidden <span> element with tracking data inside each product link. In certain theme configurations, this can interfere with the expected behavior of the link.
Specifically, the plugin's scripts that manage WooCommerce page events (like gtm4wp_page_loading_completed() and gtm4wp_process_woocommerce_pages()) can sometimes break the native functionality of product listings, especially when navigating back through the browser's history. This often results in links that appear normal but are completely unresponsive to clicks.
How to Fix It: Step-by-Step Solutions
Solution 1: Apply the Official Code Patch (Recommended)
The development team has addressed this issue in recent updates. The most reliable fix is to ensure your plugin is up-to-date. If you are experiencing the problem on an older version, updating to the latest release should resolve it.
If you cannot update immediately or are testing on a development site, you can manually apply the code changes that fixed the issue. The crucial patches can be found on the plugin's GitHub repository:
Warning: Modifying core plugin files is not recommended for most users, as changes will be overwritten during the next update. This method is best handled by a developer.
Solution 2: Temporarily Disable Enhanced Ecommerce Tracking
A quick diagnostic step is to temporarily disable the enhanced ecommerce features. Navigate to your GTM4WP settings:
- Go to Google Tag Manager -> Integration -> WooCommerce.
- Uncheck the box for Track enhanced e-commerce.
- Save changes and clear your site's cache (if you use a caching plugin).
- Test if the product links are now working correctly.
If this resolves the issue, it confirms that the conflict is related to this feature. You can then decide to keep it disabled while waiting for a plugin update or seek a more permanent solution.
Solution 3: Check for Theme and Plugin Conflicts
While the issue is often directly related to GTM4WP, it can be exacerbated by other factors. A general troubleshooting step is to perform a conflict test:
- Deactivate all other plugins except for WooCommerce and GTM4WP.
- Switch your theme to a default WordPress theme like Twenty Twenty-One.
- Test if the problem persists. If it is resolved, reactivate your plugins and theme one by one to identify the specific conflict.
Solution 4: Review Your GTM Container Code
In some cases, the problem may not be the GTM4WP plugin itself, but custom JavaScript code running in your Google Tag Manager container. As seen in one support thread, an error like Uncaught TypeError: Cannot read properties of undefined (reading 'detail') was caused by a custom GTM script, not the plugin.
To test this, try temporarily publishing an empty GTM container or using a dummy container ID (like GTM-XXXXXX) in the GTM4WP settings. If the issue disappears, the problem lies within your GTM container's custom code.
Conclusion
The problem of unclickable product links is a known compatibility issue that the 'GTM4WP – A Google Tag Manager (GTM) plugin for WordPress' team has worked to resolve. The most effective solution is to update the plugin to its latest version, which contains the necessary patches. If updating is not immediately possible, the other troubleshooting methods outlined above can help identify and mitigate the problem until a permanent update can be applied.
Related Support Threads Support
-
safari back problemhttps://wordpress.org/support/topic/safari-back-problem/
-
Google Chrome console error.https://wordpress.org/support/topic/google-chrome-console-error-3/
-
Linking recently viewed products doesn’t workhttps://wordpress.org/support/topic/linking-recently-viewed-products-doesnt-work/
-
Using the plugin on a SPA reloads the page when going to a single product pagehttps://wordpress.org/support/topic/using-the-plugin-on-a-spa-reloads-the-page-when-going-to-a-single-product-page/
-
productImpressionEEC does not appearhttps://wordpress.org/support/topic/productimpressioneec-does-not-appear/
-
Error Woodmart image galleryhttps://wordpress.org/support/topic/error-woodmart-image-gallery/
-
Update 1.16 causes 403 Forbidden errorhttps://wordpress.org/support/topic/update-1-16-causes-403-forbidden-error/
-
Shop Links Broken After Clicking Backhttps://wordpress.org/support/topic/shop-links-broken-after-clicking-back/
-
there is a woocomers + safari problemhttps://wordpress.org/support/topic/there-is-a-woocomers-safari-problem/
-
Product links not workinghttps://wordpress.org/support/topic/product-links-not-working/
-
Missing class “woocommerce-loop-product__link”https://wordpress.org/support/topic/missing-class-woocommerce-loop-product__link/
-
Linking recently viewed products doesn’t workhttps://wordpress.org/support/topic/linking-recently-viewed-products-doesnt-work-2/
-
Problem with ShopIsle theme (I tried all ways to inject code)https://wordpress.org/support/topic/problem-with-shopisle-theme-i-tried-all-ways-to-inject-code/
-
Product Carousel broken with GTMhttps://wordpress.org/support/topic/product-carousel-broken-with-gtm/
-
Sort by price:low to high not workinghttps://wordpress.org/support/topic/sort-by-pricelow-to-high-not-working/
-
Cannot open products after upgrading to 1.14.xhttps://wordpress.org/support/topic/cannot-open-products-after-upgrading-to-1-14-x/
-
Track enhanced e-commerce problemshttps://wordpress.org/support/topic/track-enhanced-e-commerce-problems/
-
White screen few secondshttps://wordpress.org/support/topic/white-screen-few-seconds/
-
Product archives links unclickable when plugin activatedhttps://wordpress.org/support/topic/product-archives-links-unclickable-when-plugin-activated/
-
Dissapeared images when plugin activehttps://wordpress.org/support/topic/dissapeared-images-when-plugin-active/
-
Error with Flatsomehttps://wordpress.org/support/topic/error-with-flatsome/
-
Extra parameters added to “hreflang” URLhttps://wordpress.org/support/topic/extra-parameters-added-to-hreflang-url/
-
1.15.2 breaks post previewshttps://wordpress.org/support/topic/1-15-2-breaks-post-previews/
-
Enhanced ecommerce issuehttps://wordpress.org/support/topic/enhanced-ecommerce-issue-3/
-
Automatically return page 1https://wordpress.org/support/topic/automatically-return-page-1/
-
does not return back, the same page is loaded.https://wordpress.org/support/topic/does-not-return-back-the-same-page-is-loaded-2/
-
Breaking Carouselhttps://wordpress.org/support/topic/breaking-carousel/
-
Problem in firefox when click on articelhttps://wordpress.org/support/topic/problem-in-firefox-when-click-on-articel/
-
Plugin is adding strings on urlhttps://wordpress.org/support/topic/plugin-is-adding-strings-on-url/
-
Returning to Previous Versionhttps://wordpress.org/support/topic/returning-ti-older-version/
-
Duplicated owl-item for carouselshttps://wordpress.org/support/topic/duplicated-owl-item-for-carousels/
-
On 3 products a 403 acces denied errorhttps://wordpress.org/support/topic/on-3-products-a-403-acces-denied-error/