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: Track remaining MVP events and properties #15151

Merged
merged 16 commits into from
Feb 19, 2025

Conversation

iamgabrielma
Copy link
Contributor

@iamgabrielma iamgabrielma commented Feb 14, 2025

#15148 needs to be reviewed first.

Closes: #15150
Closes: #15057

Changes

  • updated exit_menu_item_tapped and exit_confirmed to remove pos duplication on the event name
  • added a new event for back_to_checkout_from_cash
  • added a new event for view_docs_tapped
  • Added remaining events (details below)

Description

Testing information

  1. Add a product to the cart, observe pos_interaction_with_customer_started event:
🔵 Tracked pos_interaction_with_customer_started, properties: [blog_id: -1, is_wpcom_store: false, was_ecommerce_trial: false, plan: , store_id: c5bd46cc-1804-4f7b-badb-bb98c449127f, site_url: https://indiemelon.mystagingwebsite.com]
  1. Attempt to pay an order via cash, but tap on "<" to go back to the dashboard and cancel the operation. Observe the event pos_back_to_checkout_from_cash:
🔵 Tracked pos_back_to_checkout_from_cash, properties: [was_ecommerce_trial: false, store_id: c5bd46cc-1804-4f7b-badb-bb98c449127f, plan: , blog_id: -1, site_url: https://indiemelon.mystagingwebsite.com, is_wpcom_store: false]
  1. Tap on the floating ... menu, then on documentation, observe pos_view_docs_tapped event
🔵 Tracked pos_view_docs_tapped, properties: [blog_id: -1, site_url: https://indiemelon.mystagingwebsite.com, store_id: c5bd46cc-1804-4f7b-badb-bb98c449127f, is_wpcom_store: false, plan: , was_ecommerce_trial: false]
  1. Attempt to pay an order via card, when the reader is connected and ready to accept card, observe pos_reader_ready_for_card_payment event (no need to proceed with the payment). Observe it also has a waiting_time property. This tracks the elapsed time between order creation and card readyness.
🔵 Tracked pos_reader_ready_for_card_payment, properties: [was_ecommerce_trial: false, plan: , site_url: https://indiemelon.mystagingwebsite.com, blog_id: -1, is_wpcom_store: false, store_id: c5bd46cc-1804-4f7b-badb-bb98c449127f, waiting_time: 10.287631034851074]
  1. Pay the order via cash, on success observe pos_cash_collect_payment_success. This has a milliseconds_since_customer_interaction_started property since an item was added to the cart.
🔵 Tracked pos_cash_collect_payment_success, properties: [store_id: c5bd46cc-1804-4f7b-badb-bb98c449127f, blog_id: -1, was_ecommerce_trial: false, milliseconds_since_customer_interaction_started: 10468.0, site_url: https://indiemelon.mystagingwebsite.com, plan: , is_wpcom_store: false]

  • 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.

@dangermattic
Copy link
Collaborator

dangermattic commented Feb 14, 2025

2 Warnings
⚠️ View files have been modified, but no screenshot or video is included in the pull request. Consider adding some for clarity.
⚠️ This PR is assigned to the milestone 21.8. This milestone is due in less than 2 days.
Please make sure to get it merged by then or assign it to a milestone with a later deadline.
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 changed the title Task/pos remaining mvp events [Woo POS] MVP analytics: Track temaining MVP events and properties 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 Numberpr15151-1bafc53
Version21.7
Bundle IDcom.automattic.alpha.woocommerce
Commit1bafc53
App Center BuildWooCommerce - Prototype Builds #13025
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

@iamgabrielma iamgabrielma added type: task An internally driven task. category: tracks Related to analytics, including Tracks Events. feature: POS labels Feb 17, 2025
@iamgabrielma iamgabrielma added this to the 21.8 milestone Feb 17, 2025
@iamgabrielma iamgabrielma changed the title [Woo POS] MVP analytics: Track temaining MVP events and properties [Woo POS] MVP analytics: Track remaining MVP events and properties Feb 17, 2025
@iamgabrielma iamgabrielma marked this pull request as ready for review February 17, 2025 13:12
@iamgabrielma iamgabrielma requested a review from staskus February 17, 2025 13:12
…k/pos-remaining-mvp-events

# Conflicts:
#	WooCommerce/Classes/POS/Analytics/POSCollectOrderPaymentAnalytics.swift
#	WooCommerce/Classes/POS/Models/PointOfSaleAggregateModel.swift
Base automatically changed from task/collect-payment-success-event-properties to trunk February 18, 2025 13:55
Copy link
Contributor

@staskus staskus left a comment

Choose a reason for hiding this comment

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

Thanks! Works as expected. The only comment is to align orderCreated event with Android and call it even if order hasn't changed.

@@ -83,6 +96,11 @@ final class POSCollectOrderPaymentAnalytics: CollectOrderPaymentAnalyticsTrackin
func resetCheckoutTapCountTracker() {
checkoutTapCount = 0
}

private func trackElapsedTimeFromOrderCreationToCardReady() {
let elapsedTime = cardReaderReady - orderCreated
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's track orderCreated both when newOrder is created and the existing one is reused to align with Android p1739888487411149/1739867347.923049-slack-C070SJRA8DP.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! Updated here: 1bafc53 and confirmed that we only track it on newOrder and orderUpdated cases.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks! 🚀


static func cashCollectPaymentSuccess(millisecondsSinceCustomerIteractionStarted: Double) -> WooAnalyticsEvent {
WooAnalyticsEvent(statName: .pointOfSaleCashCollectPaymentSuccess, properties: [
Key.millisecondsSinceCustomerInteractionStarted: "\(millisecondsSinceCustomerIteractionStarted)",
Copy link
Contributor

Choose a reason for hiding this comment

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

Theoretically we could also track millisecondsSinceOrderCreationSuccess but maybe it's not needed.

We track this property when the order is created or updated
@iamgabrielma iamgabrielma merged commit f5ccde0 into trunk Feb 19, 2025
11 of 12 checks passed
@iamgabrielma iamgabrielma deleted the task/pos-remaining-mvp-events branch February 19, 2025 08:47
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
4 participants