From 8c493595cb643f9be94d5fa2501b89ea7596c9bb Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Fri, 13 Dec 2024 15:16:33 -0800 Subject: [PATCH] Fix tracking events like add_to_cart in WooCommerce integration with WWO --- plugins/web-worker-offloading/third-party/woocommerce.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/plugins/web-worker-offloading/third-party/woocommerce.php b/plugins/web-worker-offloading/third-party/woocommerce.php index 749d44d4a..4ab54b966 100644 --- a/plugins/web-worker-offloading/third-party/woocommerce.php +++ b/plugins/web-worker-offloading/third-party/woocommerce.php @@ -29,17 +29,14 @@ function plwwo_woocommerce_configure( $configuration ): array { $configuration['forward'][] = 'dataLayer.push'; $configuration['forward'][] = 'gtag'; - $configuration['mainWindowAccessors'][] = 'wp'; // Because woocommerce-google-analytics-integration needs to access wp.i18n. - $configuration['mainWindowAccessors'][] = 'ga4w'; // Because woocommerce-google-analytics-integration needs to access window.ga4w. - return $configuration; } add_filter( 'plwwo_configuration', 'plwwo_woocommerce_configure' ); plwwo_mark_scripts_for_offloading( + // Note: 'woocommerce-google-analytics-integration' is intentionally not included because for some reason events like add_to_cart don't get tracked. array( 'google-tag-manager', - 'woocommerce-google-analytics-integration', 'woocommerce-google-analytics-integration-gtag', ) );