• Resolved nukurt

    (@kurtnuimage)


    Hi,

    I need to remove the Tag Manager code which is generated by this plugin. It’s generated like so:

    <!-- Global site tag (gtag.js) - Google Ads: XX-XXXXXXXXX - Google for WooCommerce --> <script async src="https://www.googletagmanager.com/gtag/js?id=XX-XXXXXXXX"></script> <script>...</script> </head>

    The reason I need to remove it is because we’ve already added the Tag manager code separately. The ID it uses is incorrect for the one we want to use for tracking in Tag Manager. The duplicate script added by the plugin is causing issues with our conversion tracking. Our other Tag Manager account is already setup to correctly track conversions but this script is causing it to break.

    I thought I’d be able to remove it using the filter detailed here – https://github.com/woocommerce/google-listings-and-ads/blob/develop/src/Hooks/README.md#woocommerce_gla_disable_gtag_tracking – but this didn’t seem to change anything.

    Instead I’ve had to manually comment out line 257 of the GlobalSiteTag class file. But obviously this isn’t a good solution as the change will be replaced when updating the plugin.

    • This topic was modified 2 months, 2 weeks ago by nukurt.
    • This topic was modified 2 months, 2 weeks ago by nukurt.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Zubair Zahid (woo-hc)

    (@doublezed2)

    Hello nukurt,

    Thank you for contacting Woo support.

    The Google Tag Manager script is automatically generated by the Google for WooCommerce plugin to handle tracking and reporting, so there’s no built-in option to remove it entirely.

    Since you’ve already added your Tag Manager code separately, I’d recommend adjusting your existing GTM settings to remove any overlapping Google Ads tracking. This way, the Google for WooCommerce plugin can manage the tracking while avoiding conflicts with your custom setup.

    Regarding the filter you mentioned (woocommerce_gla_disable_gtag_tracking), it should work for disabling the tracking but not for removing the entire Tag Manager code.

    Let me know if you need further assistance.

    Best regards.

    @kurtnuimage there is a commend on the Github for ‘Google for Woocommerce’ that explains how to get woocommerce_gla_disable_gtag_tracking working:

    https://github.com/woocommerce/google-listings-and-ads/issues/2465#issuecomment-2342869256

    Thread Starter nukurt

    (@kurtnuimage)

    @doublezed2 – Really feels like there should be a setting to remove the script easily instead of having to modify the plugin files directly. As a developer, I’m not too familiar with the GTM settings so I’m not too sure what adjustments i would need to make in order to remove any overlapping Google Ads tracking. Again, we don’t need Google for WooCommerce to be used for any tracking really, the main reason I’m using it is to ensure products are correctly pushed through to the Merchant Centre / Google Ads account. All the tracking across the website is handled through our own Google Tag Manager script.

    @zendev – This looks interesting, i might have to give this a go, thanks for the resource. Seems like it might do the trick of removing the purchase event, which i believe is what is causing our conflict.

    Plugin Support ckadenge (woo-hc)

    (@ckadenge)

    Hi @kurtnuimage,

    All the tracking across the website is handled through our own Google Tag Manager script.

    The Google for WooCommerce plugin is designed to provide a comprehensive solution, including tracking. We understand that some developers, like yourself, have specific needs, such as using your own Google Tag Manager script for tracking.

    Unfortunately, there is currently no built-in setting in the plugin to disable the tracking script without modifying the plugin files. However, you can make a feature request here.

    ?Seems like it might do the trick of removing the purchase event, which i believe is what is causing our conflict.

    You can try the recommended code and let us know how it goes.

    Cheers.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.