diff --git a/Multisig/Cross-layer/Analytics/TrackingEvent.swift b/Multisig/Cross-layer/Analytics/TrackingEvent.swift index 0c4990219..f987617c6 100644 --- a/Multisig/Cross-layer/Analytics/TrackingEvent.swift +++ b/Multisig/Cross-layer/Analytics/TrackingEvent.swift @@ -471,6 +471,14 @@ enum TrackingEvent: String, Trackable { case screenStartCreatePassword = "screen_set_pw_start" case screenCreatePassword = "screen_set_pw_create" case screenCreatePasswordSuccess = "screen_set_pw_sucess" + + // Export and Import Data + case screenExportInstructions = "screen_export_instructions" + case screenExportSuccess = "screen_exportdata_success" + + case screenImportInstructions = "screen_import_instructions" + case screenImportSuccess = "screen_importdata_success" + } extension TrackingEvent { diff --git a/Multisig/Features/Data Export/ExportDataFlow.swift b/Multisig/Features/Data Export/ExportDataFlow.swift index 9aad5d152..b6b75663a 100644 --- a/Multisig/Features/Data Export/ExportDataFlow.swift +++ b/Multisig/Features/Data Export/ExportDataFlow.swift @@ -19,6 +19,8 @@ class ExportDataFlow: UIFlow { let vc = CommonInstructionsViewController() vc.title = "Export Data" + vc.trackingEvent = .screenExportInstructions + vc.steps = [ .header, .step(number: "1", title: "Create a file password", description: "Enter a strong password for locking the export file."), @@ -84,6 +86,7 @@ class ExportDataFlow: UIFlow { secondaryAction: "Done" ) vc.reenablesNavBar = false + vc.setTrackingData(trackingEvent: .screenExportSuccess) vc.onDone = { [weak self, unowned vc] isPrimary in if isPrimary { @@ -115,7 +118,8 @@ class ExportDataFlow: UIFlow { class CommonInstructionsViewController: InstructionsViewController { var onStart: (() -> Void)? - + var trackingEvent: TrackingEvent? + convenience init() { self.init(namedClass: InstructionsViewController.self) } @@ -123,4 +127,11 @@ class CommonInstructionsViewController: InstructionsViewController { override func didTapButton(_ sender: Any) { onStart?() } + + override func viewDidAppear(_ animated: Bool) { + super.viewDidAppear(animated) + if let trackingEvent = trackingEvent { + Tracker.trackEvent(trackingEvent) + } + } } diff --git a/Multisig/Features/Data Export/ImportDataFlow.swift b/Multisig/Features/Data Export/ImportDataFlow.swift index 2af935753..9463c6141 100644 --- a/Multisig/Features/Data Export/ImportDataFlow.swift +++ b/Multisig/Features/Data Export/ImportDataFlow.swift @@ -18,6 +18,7 @@ class ImportDataFlow: UIFlow { func instructions() { let vc = CommonInstructionsViewController() vc.title = "Import Data" + vc.trackingEvent = .screenImportInstructions vc.steps = [ .header, @@ -79,6 +80,7 @@ class ImportDataFlow: UIFlow { secondaryAction: nil ) vc.reenablesNavBar = false + vc.setTrackingData(trackingEvent: .screenImportSuccess) vc.onDone = { [weak self] _ in self?.stop(success: true)