Log what is the first action (create, import, watch wallet) for new installs

pull/2833/head
Hwee-Boon Yar 3 years ago
parent e099d58d5a
commit 30bcac9058
  1. 7
      AlphaWallet/Analytics/Models/AnalyticsTypes.swift
  2. 4
      AlphaWallet/AppCoordinator.swift
  3. 11
      AlphaWallet/Wallet/Coordinators/WalletCoordinator.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
}
}

@ -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)
}

@ -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])
}
}
Loading…
Cancel
Save