Skip to content

Conversation

@jaclync
Copy link
Contributor

@jaclync jaclync commented Sep 24, 2025

Part of WOOMOB-935

Description

Refactors WaitingTimeTracker to remove its Analytics dependency so that it can be moved to WooFoundation for future reuse across the app and Point of Sale (POS) module. The refactored WaitingTimeTracker is now a pure utility class that tracks time intervals and generates analytics events, while AppStartupWaitingTimeTracker serves as a wrapper that handles analytics tracking.

Key Changes:

  • Moved WaitingTimeTracker from WooCommerce/Classes/Analytics/ to Modules/Sources/WooFoundation/Utilities/
  • Removed direct Analytics dependency from WaitingTimeTracker
  • WaitingTimeTracker now returns WooAnalyticsEvent objects instead of directly tracking events
  • AppStartupWaitingTimeTracker wraps WaitingTimeTracker and handles analytics service interaction
  • Updated all usage sites to work with the refactored architecture

Steps to reproduce

  1. App Startup Waiting Time Tracking:

    • Launch the app from a fresh install or after force-closing, or switching stores
    • Verify app startup waiting time event is tracked in application_opened_waiting_time_loaded's waiting_time
  2. Dashboard Performance Tracking:

    • Launch the app
    • Verify that dashboard main stats waiting time is tracked in dashboard_main_stats_waiting_time_loaded's waiting_time
    • Verify that dashboard top performers waiting time is tracked in dashboard_top_performers_waiting_time_loaded's waiting_time
  3. Analytics Hub Tracking:

    • Navigate to My store tab > tap "View all store analytics" to visit Analytics Hub
    • Verify analytics hub loading time is tracked correctly in analytics_hub_waiting_time_loaded's waiting_time
  4. Order Details Tracking:

    • Navigate to Orders → Select any order
    • Verify order details waiting time is tracked in order_detail_waiting_time_loaded's waiting_time
  5. Point of Sale Tracking:

    • Tap on the POS tab
    • Verify POS loading time tracking works correctly in pos_loaded's milliseconds_time_elapsed_in_splash_screen

Testing information


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

…t it can be moved to WooFoundation. `AppStartupWaitingTimeTracker` is now a wrapper of `WaitingTimeTracker`.
@dangermattic
Copy link
Collaborator

dangermattic commented Sep 24, 2025

1 Warning
⚠️ View files have been modified, but no screenshot or video is included in the pull request. Consider adding some for clarity.

Generated by 🚫 Danger

@jaclync jaclync added type: task An internally driven task. feature: POS labels Sep 24, 2025
@jaclync jaclync added this to the 23.4 milestone Sep 24, 2025
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Sep 24, 2025

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

App NameWooCommerce iOS Prototype
Build Numberpr16169-bdf07a1
Version23.3
Bundle IDcom.automattic.alpha.woocommerce
Commitbdf07a1
Installation URL18vqbv7jcgv1o
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@jaclync jaclync changed the title Refactor WaitingTimeTracker to remove Analytics dependency for WooFoundation compatibility [Woo POS] Modularization: refactor WaitingTimeTracker to remove Analytics dependency and move it to WooFoundation Sep 24, 2025
@jaclync jaclync requested a review from staskus September 24, 2025 08:11
case .analyticsHub:
return WooAnalyticsEvent(statName: .analyticsHubWaitingTimeLoaded, properties: [Keys.waitingTime: elapsedTime])
case .appStartup:
return WooAnalyticsEvent(statName: .applicationOpenedWaitingTimeLoaded, properties: [Keys.waitingTime: elapsedTime])
Copy link
Contributor

Choose a reason for hiding this comment

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

It's likely not related to this PR, but if you open the Woo app, and after some time change the site, the elapsed time is logged from the app launch up until the site change.

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 tested outside this PR, and confirmed the same behavior. It seems to be from the stats and onboarding tasks are always reloaded every app launch, and the completion of these reloads is required for logging the event:

// If all actions completed without any errors, send the analytics event.
if startupActionsPending.isEmpty {
super.end()
}

I'm guessing this event was for performance measurement (Eagle worked on it) while the stats/onboarding were always reloaded (it was the case before), then the app changed to not always reload the stats/onboarding tasks. AppStartupWaitingTimeTracker also doesn't get reset when switching stores, so the loading time could become inaccurately longer as the starting time was from app launch. But since this is pre-existing behavior, perhaps the team working on it could revisit this performance metric.

@jaclync jaclync merged commit 2c9fd8a into trunk Sep 30, 2025
15 checks passed
@jaclync jaclync deleted the feat/WOOMOB-935-refactor-WaitingTimeTracker-and-move-to-WooFoundation branch September 30, 2025 04:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature: POS type: task An internally driven task.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants