Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tracking events like add_to_cart in WooCommerce integration #1740

Merged
merged 1 commit into from
Dec 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions plugins/web-worker-offloading/third-party/woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe add a todo to look into why? could be a bug worth raising upstream, or maybe something we can fix.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. Done in #1741.

array(
'google-tag-manager',
'woocommerce-google-analytics-integration',
'woocommerce-google-analytics-integration-gtag',
)
);
Loading