Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Ensure woocommerceanalytics_product_checkout fires for stores that use blocks #2031

Closed
haszari opened this issue Mar 26, 2020 · 3 comments · Fixed by #2038 or Automattic/jetpack#15223
Assignees
Milestone

Comments

@haszari
Copy link
Member

haszari commented Mar 26, 2020

We'll use the woocommerceanalytics events (from Jetpack) for measuring conversion rate of the new block-based cart & checkout, and comparing with existing (shortcode) flow.

We need the checkout event to fire correctly for stores using blocks, in particular when the checkout block is viewed.

See also #2032 #2030

@haszari haszari changed the title Ensure woocommerceanalytics_product_checkout fires for stores that use blocks #2030 Ensure woocommerceanalytics_product_checkout fires for stores that use blocks Mar 26, 2020
@haszari haszari self-assigned this Mar 26, 2020
@haszari haszari added this to the Future Release milestone Mar 26, 2020
@haszari haszari assigned haszari and unassigned haszari Mar 26, 2020
@haszari haszari reopened this Mar 31, 2020
@haszari
Copy link
Member Author

haszari commented Mar 31, 2020

Reopening – #2038 (comment)

We'll need to use a new hook – the one I used in #2038 is not appropriate.

@haszari
Copy link
Member Author

haszari commented Mar 31, 2020

I've opened a PR in Jetpack to fix this, using one of the new checkout hooks: Automattic/jetpack#15223

Jetpack woo analytics now hooks woocommerce_blocks_enqueue_checkout_block_scripts_after as well as woocommerce_after_checkout_form to send the checkout event. Note that the events are sent as JS - this is rendered using WooCommerce utility wc_enqueue_js(). For full details check wp-woocommerce-analytics-universal.php in Jetpack (on the PR).

@nerrad Can you give this a review when you're back on - I want to make sure that this is use of the new hook is safe and as intended. The difference between this fix and #2038 is the expectations on the hook, it's being fired in basically the same place (checkout block PHP render()).

@nerrad
Copy link
Contributor

nerrad commented Apr 1, 2020

I reviewed the pr, but I also left a comment on it with a question.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.