From d039b75e9e0d9e511d496d7219e55b6e5514b98b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomek=20Wytr=C4=99bowicz?= Date: Fri, 1 Mar 2024 18:57:30 +0100 Subject: [PATCH] Consider `ga_gtag_enabled=yes` for WCGAI >= 2 Addresses https://github.com/woocommerce/google-listings-and-ads/pull/2287#discussion_r1508145827 --- src/Proxies/GoogleGtagJs.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Proxies/GoogleGtagJs.php b/src/Proxies/GoogleGtagJs.php index 3b6f88726a..80d667a3b8 100644 --- a/src/Proxies/GoogleGtagJs.php +++ b/src/Proxies/GoogleGtagJs.php @@ -22,7 +22,9 @@ public function __construct() { $this->wcga_settings = get_option( 'woocommerce_google_analytics_settings', [] ); // Prime some values. - if ( empty( $this->wcga_settings['ga_gtag_enabled'] ) ) { + if ( defined( '\WC_GOOGLE_ANALYTICS_INTEGRATION_VERSION' ) && version_compare( \WC_GOOGLE_ANALYTICS_INTEGRATION_VERSION, '2.0.0', '>=' ) ) { + $this->wcga_settings['ga_gtag_enabled'] = 'yes'; + } elseif ( empty( $this->wcga_settings['ga_gtag_enabled'] ) ) { $this->wcga_settings['ga_gtag_enabled'] = 'no'; } if ( empty( $this->wcga_settings['ga_standard_tracking_enabled'] ) ) {