-
Notifications
You must be signed in to change notification settings - Fork 107
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
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
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. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!
Important
This is a sub-PR of #1686
While testing Web Worker Offloading, I discovered that
add_to_cart
events weren't getting sent to GA when clicking the Add To Cart button. It seems I should not have included thewoocommerce-google-analytics-integration
script among those which are offloaded because then it's not picking up on the button click event for some reason. Only the initialview_item_list
event was getting sent. So in this PR I've undone that so that theadd_to_cart
event can be sent to GA:Before:
Screen.recording.2024-12-13.15.18.54.webm
After:
Screen.recording.2024-12-13.15.19.56.webm