woocommerce / google-listings-and-ads

Sync your store with Google to list products for free, run paid ads, and track performance straight from your store dashboard.
https://woo.com/products/google-listings-and-ads/
GNU General Public License v3.0
44 stars 21 forks source link

Disable the gtag conversion and purchase tracking #2465

Closed nayaabkhan closed 1 month ago

nayaabkhan commented 1 month ago

User story

As a merchant, I can disable the gtag tracking when using another plugin like GTM4WP.

Is your feature request related to a problem?

We use GTM4WP to send ecommerce events to GA4. We noticed that this plugin also adds a purchase event which causes double purchases in the GA reports.

Describe the solution you'd like

A setting to disable the tracking, which by default could be enabled for backwards compatibility.

Technical

Source in question is: https://github.com/woocommerce/google-listings-and-ads/blob/develop/src/Google/GlobalSiteTag.php#L410

mikkamp commented 1 month ago

Hi @nayaabkhan

Is your request any different then the solution implemented in PR #1633

If not then you can use the provided filter:

add_filter( 'woocommerce_gla_disable_gtag_tracking', '__return_true' );

If that works for you we can go ahead and close this issue. We decided specifically not to go with a setting as we want to ensure that there is an alternative tracking solution in place, so the filter can be used by plugins to override the tracking.

nayaabkhan commented 1 month ago

Sure let me take a look and I'll close this if the filter is enough.