File tree Expand file tree Collapse file tree 3 files changed +16
-4
lines changed Expand file tree Collapse file tree 3 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -1722,6 +1722,7 @@ extension WooAnalyticsEvent {
17221722 enum ProductsOnboarding {
17231723 enum Keys : String {
17241724 case type
1725+ case templateEligible = " template-eligible "
17251726 }
17261727
17271728 enum CreationType : String {
@@ -1746,5 +1747,9 @@ extension WooAnalyticsEvent {
17461747 static func productCreationTypeSelected( type: CreationType ) -> WooAnalyticsEvent {
17471748 WooAnalyticsEvent ( statName: . addProductCreationTypeSelected, properties: [ Keys . type. rawValue: type. rawValue] )
17481749 }
1750+
1751+ static func productListAddProductButtonTapped( templateEligible: Bool ) -> WooAnalyticsEvent {
1752+ WooAnalyticsEvent ( statName: . productListAddProductTapped, properties: [ Keys . templateEligible. rawValue: templateEligible] )
1753+ }
17491754 }
17501755}
Original file line number Diff line number Diff line change @@ -65,6 +65,9 @@ final class AddProductCoordinator: Coordinator {
6565 }
6666
6767 func start( ) {
68+
69+ ServiceLocator . analytics. track ( event: . ProductsOnboarding. productListAddProductButtonTapped ( templateEligible: isTemplateOptionsEligible ( ) ) )
70+
6871 if shouldPresentProductCreationBottomSheet ( ) {
6972 presentProductCreationTypeBottomSheet ( )
7073 } else {
@@ -77,10 +80,16 @@ final class AddProductCoordinator: Coordinator {
7780private extension AddProductCoordinator {
7881
7982 /// Defines if the product creation bottom sheet should be presented.
80- /// Currently returns `true` when the feature is enabled and the number of products is fewer than 3 .
83+ /// Currently returns `true` when the feature is enabled and the store is eligible for displaying template options .
8184 ///
8285 func shouldPresentProductCreationBottomSheet( ) -> Bool {
83- isProductCreationTypeEnabled && productsResultsController. numberOfObjects < 3
86+ isProductCreationTypeEnabled && isTemplateOptionsEligible ( )
87+ }
88+
89+ /// Returns `true` when the number of products is fewer than 3.
90+ ///
91+ func isTemplateOptionsEligible( ) -> Bool {
92+ productsResultsController. numberOfObjects < 3
8493 }
8594
8695 /// Presents a bottom sheet for users to choose if they want a create a product manually or via a template.
Original file line number Diff line number Diff line change @@ -258,8 +258,6 @@ private extension ProductsViewController {
258258 return
259259 }
260260
261- ServiceLocator . analytics. track ( . productListAddProductTapped)
262-
263261 let coordinatingController : AddProductCoordinator
264262 if let sourceBarButtonItem = sourceBarButtonItem {
265263 coordinatingController = AddProductCoordinator ( siteID: siteID,
You can’t perform that action at this time.
0 commit comments