-
Notifications
You must be signed in to change notification settings - Fork 115
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
[Woo POS] MVP Analytics: Card payment success event properties #15148
Conversation
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.
Generated by 🚫 Danger |
|
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.
Thanks! It works well! However, there are a few concerns to address:
- If we consider order creation always when we checkout or only when the new order is actually created?
- Processing event happens multiple times, even a couple of seconds after the tap.
- Checkout tracker is not reset if POS is closed and reopened.
WooCommerce/WooCommerceTests/POS/Analytics/POSCollectOrderPaymentAnalyticsTests.swift
Show resolved
Hide resolved
The Stripe SDK returns multiple `.processing` events, but we want to capture the first one in the stream only. This flag is reset as soon as the payment has been successful
Thanks for the review @staskus ! This is ready for another round. Just a recap as per slack:
When it's actually created we trigger the event as soon as possible. At the moment we track the
We resolved this by having a flag in the analytics tracker, as we couldn't rely on
That's alright, we reset trackers on user interaction start 👍 |
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.
Thank you for the fixes!
Left one comment about syncOrder
state
let posCartItems = cartItems.map { | ||
POSCartItem(item: $0.item, quantity: Decimal($0.quantity)) | ||
} | ||
|
||
guard !orderState.isSyncing, | ||
!posCartItems.matches(order: order) else { | ||
return | ||
return .failure(SyncOrderStateError.syncFailure) |
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.
If posCartItems.matches(order: order)
it means that that .success(.orderNotChanged)
not shat syncing failed.
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.
Appreciated, I got confused with the negative guard 🙇 fixed here and added a new case and test: af7ce8f
Description
This PR it's a continuation of #15138, and adds the following missing properties to
pos_card_present_collect_payment_success
event: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
checkout_tap_count
.While I have a specific issue logged for adding more testing around tracks, in general I found very tricky to add unit tests due to how "invasive" these are in POS, and how much we'd need to mock.
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: