Skip to content

Conversation

@westonruter
Copy link
Member

@westonruter westonruter commented Dec 13, 2024

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 the woocommerce-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 initial view_item_list event was getting sent. So in this PR I've undone that so that the add_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

@westonruter westonruter added [Type] Bug An existing feature is broken [Plugin] Web Worker Offloading Issues for the Web Worker Offloading plugin. labels Dec 13, 2024
@westonruter westonruter changed the title Fix tracking events like add_to_cart in WooCommerce integration with Web Worker Offloading Fix tracking events like add_to_cart in WooCommerce integration Dec 13, 2024
Base automatically changed from add/wwo-site-kit-integration to trunk December 14, 2024 00:03
@westonruter westonruter marked this pull request as ready for review December 14, 2024 00:03
@github-actions
Copy link

github-actions bot commented Dec 14, 2024

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: westonruter <[email protected]>
Co-authored-by: adamsilverstein <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

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.

Copy link
Member

@adamsilverstein adamsilverstein left a comment

Choose a reason for hiding this comment

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

Good catch!

@westonruter westonruter merged commit ad6a211 into trunk Dec 14, 2024
16 of 18 checks passed
@westonruter westonruter deleted the fix/woocommerce-wwo-integration branch December 14, 2024 00:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Plugin] Web Worker Offloading Issues for the Web Worker Offloading plugin. [Type] Bug An existing feature is broken

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants