Skip to content

Commit

Permalink
Merge pull request #13406 from woocommerce/13405-order-creation-track…
Browse files Browse the repository at this point in the history
…-orders-with-customers-that-are-registered-or-not

[Order Creation] Track orders with customers that are registered or not
  • Loading branch information
AnirudhBhat authored Jan 30, 2025
2 parents b45f1e6 + 18bbc62 commit 57b11e5
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ class CustomerListSelectionViewModel @Inject constructor(
private var loadingMoreInfoAboutCustomerJob: Job? = null

override fun onCustomerSelected(customerModel: WCCustomerModel) {
analyticsTracker.track(AnalyticsEvent.ORDER_CREATION_CUSTOMER_ADDED)
analyticsTracker.track(
AnalyticsEvent.ORDER_CREATION_CUSTOMER_ADDED,
mapOf("is_customer_registered" to (customerModel.remoteCustomerId > 0L).toString())
)
when {
customerModel.remoteCustomerId > 0L -> {
// this customer is registered, so we may have more info on them
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,10 @@ class CustomerListSelectionViewModelTest : BaseUnitTest() {
)
)
)
verify(analyticsTrackerWrapper).track(AnalyticsEvent.ORDER_CREATION_CUSTOMER_ADDED)
verify(analyticsTrackerWrapper).track(
AnalyticsEvent.ORDER_CREATION_CUSTOMER_ADDED,
mapOf("is_customer_registered" to "true")
)
}

@Test
Expand Down Expand Up @@ -913,7 +916,10 @@ class CustomerListSelectionViewModelTest : BaseUnitTest() {
// THEN
assertThat(states[0].partialLoading).isFalse
assertThat(states[1].partialLoading).isTrue
verify(analyticsTrackerWrapper).track(AnalyticsEvent.ORDER_CREATION_CUSTOMER_ADDED)
verify(analyticsTrackerWrapper).track(
AnalyticsEvent.ORDER_CREATION_CUSTOMER_ADDED,
mapOf("is_customer_registered" to "true")
)
}

@Test
Expand Down Expand Up @@ -966,7 +972,10 @@ class CustomerListSelectionViewModelTest : BaseUnitTest() {
)
)
)
verify(analyticsTrackerWrapper).track(AnalyticsEvent.ORDER_CREATION_CUSTOMER_ADDED)
verify(analyticsTrackerWrapper).track(
AnalyticsEvent.ORDER_CREATION_CUSTOMER_ADDED,
mapOf("is_customer_registered" to "true")
)
}

@Test
Expand Down Expand Up @@ -1026,7 +1035,10 @@ class CustomerListSelectionViewModelTest : BaseUnitTest() {
)
)
)
verify(analyticsTrackerWrapper).track(AnalyticsEvent.ORDER_CREATION_CUSTOMER_ADDED)
verify(analyticsTrackerWrapper).track(
AnalyticsEvent.ORDER_CREATION_CUSTOMER_ADDED,
mapOf("is_customer_registered" to "true")
)
}

@Test
Expand Down Expand Up @@ -1076,7 +1088,10 @@ class CustomerListSelectionViewModelTest : BaseUnitTest() {
)
)
)
verify(analyticsTrackerWrapper).track(AnalyticsEvent.ORDER_CREATION_CUSTOMER_ADDED)
verify(analyticsTrackerWrapper).track(
AnalyticsEvent.ORDER_CREATION_CUSTOMER_ADDED,
mapOf("is_customer_registered" to "false")
)
}

@Test
Expand Down

0 comments on commit 57b11e5

Please sign in to comment.