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

ensure woo analytics checkout event fires for checkout block #15223

Merged
merged 1 commit into from
Apr 1, 2020

Conversation

haszari
Copy link
Contributor

@haszari haszari commented Mar 31, 2020

Fixes woocommerce/woocommerce-blocks#2031

Changes proposed in this Pull Request:

This is currently hooked on woocommerce_after_checkout_form from WoCommerce Core. Originally we planned to fire this hook from checkout block PHP render() (#2038 - reverted), but this is not appropriate as extensions will likely render content/markup directly to output from the hook.

Is this a new feature or does it add/remove features to an existing part of Jetpack?

*p7Ldg5-ru-p2

Testing instructions:

setup
  • This requires WooCommerce to be installed and set up on the site, with some products. Recommend setting up Cash on delivery payment method for easy checkout.
  • Also requires WooCommerce Blocks checkout block – this is still in development, so you'll need to build the source
  • The events are disabled for development sites. Use an incognito window, or hack this by adding return true; at the start of Jetpack_WooCommerce_Analytics::shouldTrackStore().

test

  • Add the checkout block to a page or post.
  • Open network tab in browser dev tools, search for pixel.wp.com.
  • View a product on the front end of your site.
  • View a page/post containing checkout block. You should see a request for woocommerceanalytics_product_view event.

Optional:

  • Test that shortcode / traditional checkout event still works correctly.

Proposed changelog entry for your changes:

  • WooCommerce Analytics: Ensure checkout event fires for checkout block (currently in development).

@haszari haszari requested a review from a team March 31, 2020 22:22
@haszari haszari self-assigned this Mar 31, 2020
@haszari haszari requested a review from nerrad March 31, 2020 22:22
@haszari haszari added [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. [Status] Needs GDPR Review [Status] Needs Tracks Review Added/removed/modified a tracks event. [Feature] WooCommerce Analytics labels Mar 31, 2020
@haszari haszari added this to the 8.4 milestone Mar 31, 2020
@haszari haszari requested a review from jeherve March 31, 2020 22:23
@jetpackbot
Copy link

jetpackbot commented Mar 31, 2020

Thank you for the great PR description!

When this PR is ready for review, please apply the [Status] Needs Review label. If you are an a11n, please have someone from your team review the code if possible. The Jetpack team will also review this PR and merge it to be included in the next Jetpack release.

Scheduled Jetpack release: April 7, 2020.
Scheduled code freeze: March 31, 2020

Generated by 🚫 dangerJS against 696c378

nerrad
nerrad previously approved these changes Apr 1, 2020
Copy link
Contributor

@nerrad nerrad left a comment

Choose a reason for hiding this comment

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

Code wise, this looks okay, I did not test.

@nerrad
Copy link
Contributor

nerrad commented Apr 1, 2020

While I approved based on the code alone, I am wondering what value this tracking will bring in differentiating between shortcode checkout and block checkout? As far as I can tell when we analyse the data from these fired events, we won't be able to distinguish between what event came from the shortcode checkout and what event came from the block checkout right? Is that important?

- Hook custom action sent by checkout block render in Woo blocks plugin.
+ bonus lint comment
Copy link
Member

@jeherve jeherve left a comment

Choose a reason for hiding this comment

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

This looks good to me. I rebased to address some unrelated issues with e2e tests that were causing Travis tests to fail here.

I'll let you make the final merge decision based on the discussion above though.

@jeherve jeherve added [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! and removed [Status] Needs GDPR Review [Status] Needs Tracks Review Added/removed/modified a tracks event. [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. labels Apr 1, 2020
Copy link
Member

@deltaWhiskey deltaWhiskey left a comment

Choose a reason for hiding this comment

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

Looks good to me. Did not test.

@haszari
Copy link
Contributor Author

haszari commented Apr 1, 2020

As far as I can tell when we analyse the data from these fired events, we won't be able to distinguish between what event came from the shortcode checkout and what event came from the block checkout right? Is that important?

@nerrad Yes that is important! And we ideally need to know that for all events, e.g. purchase (order completed) also.

In #15127 we added props to all events for whether the store uses shortcodes or blocks for cart and checkout. The plan is to segment the events based on those props.

FYI we've also added the woo version (#15028) so we can segment by that if needed.

@jeherve I'm going to merge this :)

@haszari haszari merged commit 314fab5 into master Apr 1, 2020
@haszari haszari deleted the update/woo-analytics-checkout-block branch April 1, 2020 18:55
@haszari haszari removed the [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! label Apr 1, 2020
jeherve pushed a commit that referenced this pull request Apr 2, 2020
… block: (#15223)

- Hook custom action sent by checkout block render in Woo blocks plugin.
+ bonus lint comment
@jeherve
Copy link
Member

jeherve commented Apr 2, 2020

Cherry-picked to branch-8.4 in 08a964f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ensure woocommerceanalytics_product_checkout fires for stores that use blocks
6 participants