Skip to content

Commit 1bab542

Browse files
committed
Track login_what_is_jetpack_help_screen_viewed
1 parent 73fb894 commit 1bab542

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

WooCommerce/Classes/Analytics/WooAnalyticsStat.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public enum WooAnalyticsStat: String {
3737
case loginEmailFormViewed = "login_email_form_viewed"
3838
case loginJetpackRequiredScreenViewed = "login_jetpack_required_screen_viewed"
3939
case loginJetpackRequiredViewInstructionsButtonTapped = "login_jetpack_required_view_instructions_button_tapped"
40+
case loginWhatIsJetpackHelpScreenViewed = "login_what_is_jetpack_help_screen_viewed"
4041
case loginMagicLinkOpenEmailClientViewed = "login_magic_link_open_email_client_viewed"
4142
case loginMagicLinkRequestFormViewed = "login_magic_link_request_form_viewed"
4243
case loginMagicLinkExited = "login_magic_link_exited"

WooCommerce/Classes/Authentication/Navigation Exceptions/JetpackErrorViewModel.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ struct JetpackErrorViewModel: ULErrorViewModel {
6262
fancyAlert.modalPresentationStyle = .custom
6363
fancyAlert.transitioningDelegate = AppDelegate.shared.tabBarController
6464
viewController?.present(fancyAlert, animated: true)
65+
66+
analytics.track(.loginWhatIsJetpackHelpScreenViewed)
6567
}
6668

6769
func viewDidLoad(in viewController: UIViewController?) {

WooCommerce/WooCommerceTests/Authentication/JetpackErrorViewModelTests.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,20 @@ final class JetpackErrorViewModelTests: XCTestCase {
102102
let firstEvent = try XCTUnwrap(analyticsProvider.receivedEvents.first)
103103
XCTAssertEqual(firstEvent, "login_jetpack_required_view_instructions_button_tapped")
104104
}
105+
106+
func test_viewModel_logs_an_event_when_the_what_is_jetpack_button_is_tapped() throws {
107+
// Given
108+
let viewModel = JetpackErrorViewModel(siteURL: Expectations.url, analytics: analytics)
109+
110+
assertEmpty(analyticsProvider.receivedEvents)
111+
112+
// When
113+
viewModel.didTapAuxiliaryButton(in: nil)
114+
115+
// Then
116+
let firstEvent = try XCTUnwrap(analyticsProvider.receivedEvents.first)
117+
XCTAssertEqual(firstEvent, "login_what_is_jetpack_help_screen_viewed")
118+
}
105119
}
106120

107121

0 commit comments

Comments
 (0)