diff --git a/AlphaWallet/Analytics/Models/AnalyticsTypes.swift b/AlphaWallet/Analytics/Models/AnalyticsTypes.swift index e94309f80..245bb3894 100644 --- a/AlphaWallet/Analytics/Models/AnalyticsTypes.swift +++ b/AlphaWallet/Analytics/Models/AnalyticsTypes.swift @@ -55,6 +55,7 @@ enum Analytics { case clearBrowserCache = "Clear Browser Cache" case rectifySendTransactionErrorInActionSheet = "Rectify Send Txn Error" case nameWallet = "Name Wallet" + case firstWalletAction = "First Wallet Action" } enum Properties: String { @@ -149,4 +150,10 @@ enum Analytics { case token case wallet } + + enum FirstWalletAction: String { + case create + case `import` + case watch + } } diff --git a/AlphaWallet/AppCoordinator.swift b/AlphaWallet/AppCoordinator.swift index 938184ec0..11d95c699 100644 --- a/AlphaWallet/AppCoordinator.swift +++ b/AlphaWallet/AppCoordinator.swift @@ -54,7 +54,7 @@ class AppCoordinator: NSObject, Coordinator { analyticsCoordinator: analyticsService, viewModel: .init(configuration: .summary) ) - coordinator.delegate = self + coordinator.delegate = self return coordinator }() @@ -451,7 +451,7 @@ extension AppCoordinator: UrlSchemeCoordinatorDelegate { } extension AppCoordinator: AccountsCoordinatorDelegate { - + func didAddAccount(account: Wallet, in coordinator: AccountsCoordinator) { coordinator.navigationController.dismiss(animated: true) } diff --git a/AlphaWallet/Wallet/Coordinators/WalletCoordinator.swift b/AlphaWallet/Wallet/Coordinators/WalletCoordinator.swift index 920dbc551..927561dad 100644 --- a/AlphaWallet/Wallet/Coordinators/WalletCoordinator.swift +++ b/AlphaWallet/Wallet/Coordinators/WalletCoordinator.swift @@ -200,14 +200,17 @@ extension WalletCoordinator: QRCodeResolutionCoordinatorDelegate { extension WalletCoordinator: CreateInitialWalletViewControllerDelegate { func didTapCreateWallet(inViewController viewController: CreateInitialWalletViewController) { + logInitialAction(.create) createInstantWallet() } func didTapWatchWallet(inViewController viewController: CreateInitialWalletViewController) { + logInitialAction(.watch) addWalletWith(entryPoint: .watchWallet(address: nil)) } func didTapImportWallet(inViewController viewController: CreateInitialWalletViewController) { + logInitialAction(.import) addWalletWith(entryPoint: .importWallet) } } @@ -216,7 +219,6 @@ extension WalletCoordinator: WalletCoordinatorDelegate { func didFinish(with account: Wallet, in coordinator: WalletCoordinator) { coordinator.navigationController.dismiss(animated: false) - removeCoordinator(coordinator) delegate?.didFinish(with: account, in: self) } @@ -226,3 +228,10 @@ extension WalletCoordinator: WalletCoordinatorDelegate { removeCoordinator(coordinator) } } + +// MARK: Analytics +extension WalletCoordinator { + private func logInitialAction(_ action: Analytics.FirstWalletAction) { + analyticsCoordinator.log(action: Analytics.Action.firstWalletAction, properties: [Analytics.Properties.type.rawValue: action.rawValue]) + } +} \ No newline at end of file