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

[Woo POS] MVP Analytics: Card payment success event properties #15148

Open
wants to merge 6 commits into
base: trunk
Choose a base branch
from

Conversation

iamgabrielma
Copy link
Contributor

@iamgabrielma iamgabrielma commented Feb 14, 2025

Description

This PR it's a continuation of #15138, and adds the following missing properties to pos_card_present_collect_payment_success event:

milliseconds_since_order_creation_success
milliseconds_since_reader_ready_to_collect_payment
milliseconds_since_card_tapped
checkout_tap_count

In order to track these we follow the same design that the existing milliseconds_since_customer_interaction_started property, as we need to keep track of the elapsed time between the action starts and ends, before sending the event.

Testing information

  • In POS, add some items to cart, tap checkout, go back to the cart (make some edits or not) and tap checkout again, then follow the card payment flow. At the end, observe that the event has been tracked with elapsed times and a correct number of checkout_tap_count.
🔵 Tracked pos_card_present_collect_payment_success, properties: [is_wpcom_store: false, milliseconds_since_card_tapped: 5625.0, plan: , site_url: https://indiemelon.mystagingwebsite.com, checkout_tap_count: 3, store_id: c5bd46cc-1804-4f7b-badb-bb98c449127f, was_ecommerce_trial: false, milliseconds_since_customer_interaction_started: 27118.0, milliseconds_since_order_creation_success: 19099.0, blog_id: -1, milliseconds_since_reader_ready_to_collect_payment: 9861.0]
  • Repeat the flow just tapping checkout once, observe the count is 1.

  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

Reviewer (or Author, in the case of optional code reviews):

Please make sure these conditions are met before approving the PR, or request changes if the PR needs improvement:

  • The PR is small and has a clear, single focus, or a valid explanation is provided in the description. If needed, please request to split it into smaller PRs.
  • Ensure Adequate Unit Test Coverage: The changes are reasonably covered by unit tests or an explanation is provided in the PR description.
  • Manual Testing: The author listed all the tests they ran, including smoke tests when needed (e.g., for refactorings). The reviewer confirmed that the PR works as expected on all devices (phone/tablet) and no regressions are added.

We can add this event closer to order creation if we add it inside the OrderController sync function, however this couples both objects tighter. I think it’s fine to add the track event to the aggregate model as:

- It will not track the event as a side effect of order sync, as this is only called on checkout, and we always create a new order when this happens

- It would log the start time internally for both card and cash flows, however doesn’t matter as the event is only populated and sent for card events later on, and at this point we do not know how the customer is going to pay, as happens later in the flow.
@iamgabrielma iamgabrielma added type: task An internally driven task. category: tracks Related to analytics, including Tracks Events. feature: POS labels Feb 14, 2025
@dangermattic
Copy link
Collaborator

dangermattic commented Feb 14, 2025

1 Message
📖

This PR contains changes to Tracks-related logic. Please ensure (author and reviewer) the following are completed:

  • The tracks events must be validated in the Tracks system.
  • Verify the internal Tracks spreadsheet has also been updated.
  • Please consider registering any new events.
  • The PR must be assigned the category: tracks label.

Generated by 🚫 Danger

@iamgabrielma iamgabrielma added this to the 21.8 milestone Feb 14, 2025
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Feb 14, 2025

WooCommerce iOS📲 You can test the changes from this Pull Request in WooCommerce iOS by scanning the QR code below to install the corresponding build.

App NameWooCommerce iOS WooCommerce iOS
Build Numberpr15148-b94025c
Version21.7
Bundle IDcom.automattic.alpha.woocommerce
Commitb94025c
App Center BuildWooCommerce - Prototype Builds #12971
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

@iamgabrielma iamgabrielma marked this pull request as ready for review February 14, 2025 11:49
orderStage = .finalizing
await orderController.syncOrder(for: cart, retryHandler: { [weak self] in
await self?.checkOut()
})
collectOrderPaymentAnalyticsTracker.trackOrderCreationSuccess()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had my doubts if this was the best place to add the order creation success event, I left my comments in the commit 3f9b72b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: tracks Related to analytics, including Tracks Events. feature: POS type: task An internally driven task.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants