@@ -131,14 +131,20 @@ final class NewOrderViewModel: ObservableObject {
131131 ///
132132 @Published private( set) var paymentDataViewModel = PaymentDataViewModel ( )
133133
134+ /// Analytics engine.
135+ ///
136+ private let analytics : Analytics
137+
134138 init ( siteID: Int64 ,
135139 stores: StoresManager = ServiceLocator . stores,
136140 storageManager: StorageManagerType = ServiceLocator . storageManager,
137- currencySettings: CurrencySettings = ServiceLocator . currencySettings) {
141+ currencySettings: CurrencySettings = ServiceLocator . currencySettings,
142+ analytics: Analytics = ServiceLocator . analytics) {
138143 self . siteID = siteID
139144 self . stores = stores
140145 self . storageManager = storageManager
141146 self . currencyFormatter = CurrencyFormatter ( currencySettings: currencySettings)
147+ self . analytics = analytics
142148
143149 configureNavigationTrailingItem ( )
144150 configureStatusBadgeViewModel ( )
@@ -410,6 +416,8 @@ private extension NewOrderViewModel {
410416 let newOrderItem = NewOrderItem ( product: product, quantity: 1 )
411417 orderDetails. items. append ( newOrderItem)
412418 configureProductRowViewModels ( )
419+
420+ analytics. track ( event: WooAnalyticsEvent . Orders. orderProductAdd ( flow: . creation) )
413421 }
414422
415423 /// Adds a selected product variation (from the product list) to the order.
@@ -418,6 +426,8 @@ private extension NewOrderViewModel {
418426 let newOrderItem = NewOrderItem ( variation: variation, quantity: 1 )
419427 orderDetails. items. append ( newOrderItem)
420428 configureProductRowViewModels ( )
429+
430+ analytics. track ( event: WooAnalyticsEvent . Orders. orderProductAdd ( flow: . creation) )
421431 }
422432
423433 /// Configures product row view models for each item in `orderDetails`.
0 commit comments