diff --git a/PlatformParticles/PlatformParticles/_ViewController/TrackingViewController.swift b/PlatformParticles/PlatformParticles/_ViewController/TrackingViewController.swift index 3eecfe4f2..b0a38dd0a 100644 --- a/PlatformParticles/PlatformParticles/_ViewController/TrackingViewController.swift +++ b/PlatformParticles/PlatformParticles/_ViewController/TrackingViewController.swift @@ -11,9 +11,7 @@ import PlatformRouting import UIToolkits import Utilities -open class TrackingViewController: NavigableViewController, TrackingViewProtocol { - - open private(set) var navigationEvent: TrackableEvent? +open class TrackingViewController: NavigableViewController { override open func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) @@ -25,8 +23,8 @@ open class TrackingViewController: NavigableViewController, TrackingViewProtocol override open func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) - if let navigationEvent { - Tracking.shared?.log(trackableEvent: navigationEvent) + if let self = self as? TrackingViewProtocol { + self.logScreenView() } } } diff --git a/PlatformRouting/PlatformRouting/_iOS/_App/MappedUIKitRouter.swift b/PlatformRouting/PlatformRouting/_iOS/_App/MappedUIKitRouter.swift index 33f4048a4..ad31939e1 100644 --- a/PlatformRouting/PlatformRouting/_iOS/_App/MappedUIKitRouter.swift +++ b/PlatformRouting/PlatformRouting/_iOS/_App/MappedUIKitRouter.swift @@ -451,9 +451,6 @@ open class MappedUIKitRouter: MappedRouter { self?.actions.removeAll(where: { (actionInList) -> Bool in actionReference === actionInList }) - if success, request.path?.hasPrefix("/action") ?? false { - Tracking.shared?.view(request.path, data: request.params, from: nil, time: nil) - } completion?(data, success) } } else { diff --git a/Utilities/Utilities/_Tracker/_Shared/CompositeTracking.swift b/Utilities/Utilities/_Tracker/_Shared/CompositeTracking.swift index 66a2d4fc9..15dbfb649 100644 --- a/Utilities/Utilities/_Tracker/_Shared/CompositeTracking.swift +++ b/Utilities/Utilities/_Tracker/_Shared/CompositeTracking.swift @@ -39,12 +39,6 @@ open class CompositeTracking: NSObject & TrackingProtocol { } } - open func view(_ path: String?, action: String?, data: [String: Any]?, from: String?, time: Date?, revenue: NSNumber?, contextViewController: UIViewController?) { - for tracking: TrackingProtocol in trackings { - tracking.view(path, action: action, data: data, from: from, time: time, revenue: revenue, contextViewController: nil) - } - } - open func leave(_ path: String?) { for tracking: TrackingProtocol in trackings { tracking.leave(path) diff --git a/Utilities/Utilities/_Tracker/_Shared/Tracking.swift b/Utilities/Utilities/_Tracker/_Shared/Tracking.swift index b1020f97b..2a8d6fa11 100644 --- a/Utilities/Utilities/_Tracker/_Shared/Tracking.swift +++ b/Utilities/Utilities/_Tracker/_Shared/Tracking.swift @@ -11,27 +11,27 @@ import Foundation public protocol TrackingProtocol: NSObjectProtocol { var userInfo: [String: String?]? { get set } var excluded: Bool { get set } - func view(_ path: String?, action: String?, data: [String: Any]?, from: String?, time: Date?, revenue: NSNumber?, contextViewController: UIViewController?) +// func view(_ path: String?, action: String?, data: [String: Any]?, from: String?, time: Date?, revenue: NSNumber?, contextViewController: UIViewController?) func leave(_ path: String?) func log(event: String, data: [String: Any]?, revenue: NSNumber?) } public extension TrackingProtocol { - func view(_ path: String?, data: [String: Any]?, from: String?, time: Date?, revenue: NSNumber?, contextViewController: UIViewController?) { - view(path, action: nil, data: data, from: from, time: time, revenue: revenue, contextViewController: contextViewController) - } - func view(_ path: String?, data: [String: Any]?, from: String?, time: Date?, revenue: NSNumber?) { - view(path, action: nil, data: data, from: from, time: time, revenue: revenue, contextViewController: nil) - } - func view(_ path: String?, data: [String: Any]?, from: String?, time: Date?) { - view(path, action: nil, data: data, from: from, time: time, revenue: nil, contextViewController: nil) - } - func view(_ path: String?, data: [String: Any]?, from: String?, contextViewController: UIViewController?) { - view(path, action: nil, data: data, from: from, time: nil, revenue: nil, contextViewController: nil) - } - func view(_ path: String?, data: [String: Any]?) { - view(path, action: nil, data: data, from: nil, time: nil, revenue: nil, contextViewController: nil) - } +// func view(_ path: String?, data: [String: Any]?, from: String?, time: Date?, revenue: NSNumber?, contextViewController: UIViewController?) { +// view(path, action: nil, data: data, from: from, time: time, revenue: revenue, contextViewController: contextViewController) +// } +// func view(_ path: String?, data: [String: Any]?, from: String?, time: Date?, revenue: NSNumber?) { +// view(path, action: nil, data: data, from: from, time: time, revenue: revenue, contextViewController: nil) +// } +// func view(_ path: String?, data: [String: Any]?, from: String?, time: Date?) { +// view(path, action: nil, data: data, from: from, time: time, revenue: nil, contextViewController: nil) +// } +// func view(_ path: String?, data: [String: Any]?, from: String?, contextViewController: UIViewController?) { +// view(path, action: nil, data: data, from: from, time: nil, revenue: nil, contextViewController: nil) +// } +// func view(_ path: String?, data: [String: Any]?) { +// view(path, action: nil, data: data, from: nil, time: nil, revenue: nil, contextViewController: nil) +// } func log(event: String, data: [String: Any]?) { log(event: event, data: data, revenue: nil) } @@ -55,6 +55,14 @@ public protocol TrackableEvent { var customParameters: [String: Any] { get } } -public protocol TrackingViewProtocol { - var navigationEvent: TrackableEvent? { get } +public protocol TrackingViewProtocol: ScreenIdentifiable { + func logScreenView() +} + +public protocol ScreenIdentifiable { + /// the path identifier specific to mobile + var mobilePath: String { get } + /// the web path identifier which corresponds to the mobile screen + var correspondingWebPath: String? { get } + var screenClass: String { get } } diff --git a/dydx/dydx.xcworkspace/xcshareddata/swiftpm/Package.resolved b/dydx/dydx.xcworkspace/xcshareddata/swiftpm/Package.resolved index 7d9595b53..44030d6e4 100644 --- a/dydx/dydx.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/dydx/dydx.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "975d00e29efb8d2ca017c5e61df90418ac01f7d7143e85a3f9ddb4eb982154e4", + "originHash" : "1c0055be4aba3ed4d97a2f62f05486877839310f65e2cbdd18b067bef06a04a3", "pins" : [ { "identity" : "bigint", @@ -46,15 +46,6 @@ "revision" : "48134b5460435cc9d048223ad7560ee2e40f3d4a" } }, - { - "identity" : "percy-xcui-swift", - "kind" : "remoteSourceControl", - "location" : "https://github.com/percy/percy-xcui-swift", - "state" : { - "revision" : "a2e9a86dfc3f5b69ef53cbda28a0ea71098c9f77", - "version" : "1.0.0" - } - }, { "identity" : "qrcode", "kind" : "remoteSourceControl", diff --git a/dydx/dydxAnalytics/dydxAnalytics/AnalyticsEvent.swift b/dydx/dydxAnalytics/dydxAnalytics/AnalyticsEvent.swift index 026bd2956..6ad84529c 100644 --- a/dydx/dydxAnalytics/dydxAnalytics/AnalyticsEvent.swift +++ b/dydx/dydxAnalytics/dydxAnalytics/AnalyticsEvent.swift @@ -8,6 +8,8 @@ import Foundation import PlatformParticles import Utilities +import FirebaseAnalytics + // // Events defined in the v4-web repo. Ideally, we should keep this in-sync with v4-web // @@ -47,48 +49,6 @@ public enum AnalyticsEvent: String { case notificationAction = "NotificationAction" } -public extension AnalyticsEventV2 { - // probably move this to like a dydxRouter, next to where `routing_swift.json` currently lives - enum Page { - case markets - case market(market: String) - case trade(market: String) - case addSlTp - case custom(path: String) - - /// a path that uniquely identifies the mobile screen - var mobilePath: String { - switch self { - case .markets: - return "/markets" - case .trade(let market): - return "/trade/\(market)" - case .market(let market): - return "/market/\(market)" - case .addSlTp: - return "/trade/take_profit_stop_loss" - case .custom(let path): - return path - } - } - - /// the web-equivalent web page (if there is a good match) - var correspondingWebPath: String? { - switch self { - case .addSlTp: - return nil // displayed as a modal on web - case .custom: - return nil - case .market(let market): - // web does not have the /market/ETH-USD path and routes back to `/trade/ETH-USD` - return Page.trade(market: market).correspondingWebPath - default: - return mobilePath - } - } - } -} - public extension AnalyticsEventV2 { enum OnboardingStep: String { case chooseWallet = "ChooseWallet" @@ -108,23 +68,23 @@ public extension AnalyticsEventV2 { public enum AnalyticsEventV2: TrackableEvent { case appStart - case navigatePage(page: Page) - case navigateDialog(page: Page) - case navigateDialogClose(page: Page) + case navigatePage(screen: ScreenIdentifiable) + case deepLinkHandled(url: String, succeeded: Bool) + case notificationPermissionsChanged(isAuthorized: Bool) case onboardingStepChanged(step: OnboardingStep, state: OnboardingState) public var name: String { switch self { case .navigatePage: return "NavigatePage" - case .navigateDialog: - return "NavigateDialog" - case .navigateDialogClose: - return "NavigateDialogClose" + case .deepLinkHandled: + return "DeeplinkHandled" case .appStart: return "AppStart" case .onboardingStepChanged: return "OnboardingStepChanged" + case .notificationPermissionsChanged: + return "NotificationPermissionsChanged" } } @@ -132,23 +92,41 @@ public enum AnalyticsEventV2: TrackableEvent { switch self { case .appStart: return [:] - case .navigatePage(let page), .navigateDialog(let page), .navigateDialogClose(let page): + case .navigatePage(let screen): + return [ + "mobile_path": screen.mobilePath, + "path": screen.correspondingWebPath as Any, + // for firebase auto-generated dashboard(s) + "\(AnalyticsParameterScreenClass)": screen.screenClass, + "\(AnalyticsParameterScreenName)": screen.mobilePath + ] + case .deepLinkHandled(let url, let succeeded): return [ - "mobile_path": page.mobilePath, - "path": page.correspondingWebPath as Any + "successfully_handled": succeeded, + "url": url ] case .onboardingStepChanged(let step, let state): return [ "step": step.rawValue, "state": state.rawValue ] + case .notificationPermissionsChanged(let isAuthorized): + return [ + "is_authorized": isAuthorized + ] } } } public extension TrackingProtocol { - /// convenience wrapper of log(trackableEvent:) func log(event: AnalyticsEventV2) { - Tracking.shared?.log(trackableEvent: event) + log(event: event.name, data: event.customParameters) + switch event { + case .navigatePage: + // for firebase auto-generated dashboard(s) + log(event: AnalyticsEventScreenView, data: event.customParameters) + default: + break + } } } diff --git a/dydx/dydxPresenters/dydxPresenters/_v4/MarketInfo/dydxMarketInfoViewBuilder.swift b/dydx/dydxPresenters/dydxPresenters/_v4/MarketInfo/dydxMarketInfoViewBuilder.swift index 5fe3366ce..51c452c22 100644 --- a/dydx/dydxPresenters/dydxPresenters/_v4/MarketInfo/dydxMarketInfoViewBuilder.swift +++ b/dydx/dydxPresenters/dydxPresenters/_v4/MarketInfo/dydxMarketInfoViewBuilder.swift @@ -31,16 +31,6 @@ private class dydxMarketInfoViewController: HostingViewController Bool { if request?.path == "/trade" || request?.path == "/market", let presenter = presenter as? dydxMarketInfoViewPresenter { dydxSelectedMarketsStore.shared.lastSelectedMarket = selectedMarketId diff --git a/dydx/dydxPresenters/dydxPresenters/_v4/Markets/dydxMarketsViewBuilder.swift b/dydx/dydxPresenters/dydxPresenters/_v4/Markets/dydxMarketsViewBuilder.swift index da085b4c1..dbcdbcac5 100644 --- a/dydx/dydxPresenters/dydxPresenters/_v4/Markets/dydxMarketsViewBuilder.swift +++ b/dydx/dydxPresenters/dydxPresenters/_v4/Markets/dydxMarketsViewBuilder.swift @@ -29,9 +29,6 @@ public class dydxMarketsViewBuilder: NSObject, ObjectBuilderProtocol { } private class dydxMarketsViewController: HostingViewController { - - override var navigationEvent: TrackableEvent? { AnalyticsEventV2.navigatePage(page: .markets) } - override public func arrive(to request: RoutingRequest?, animated: Bool) -> Bool { request?.path == "/markets" } diff --git a/dydx/dydxPresenters/dydxPresenters/_v4/TakeProfitStopLoss/dydxTakeProfitStopLossViewPresenter.swift b/dydx/dydxPresenters/dydxPresenters/_v4/TakeProfitStopLoss/dydxTakeProfitStopLossViewPresenter.swift index 49f279181..03088df37 100644 --- a/dydx/dydxPresenters/dydxPresenters/_v4/TakeProfitStopLoss/dydxTakeProfitStopLossViewPresenter.swift +++ b/dydx/dydxPresenters/dydxPresenters/_v4/TakeProfitStopLoss/dydxTakeProfitStopLossViewPresenter.swift @@ -28,8 +28,6 @@ public class dydxTakeProfitStopLossViewBuilder: NSObject, ObjectBuilderProtocol } private class dydxTakeProfitStopLossViewController: HostingViewController { - override var navigationEvent: TrackableEvent? { AnalyticsEventV2.navigatePage(page: .addSlTp) } - override public func arrive(to request: RoutingRequest?, animated: Bool) -> Bool { if request?.path == "/trade/take_profit_stop_loss", let marketId = parser.asString(request?.params?["marketId"]), let presenter = presenter as? dydxTakeProfitStopLossViewPresenter { AbacusStateManager.shared.setMarket(market: marketId) diff --git a/dydx/dydxViews/dydxViews/SwiftUIHosting/HostingViewController.swift b/dydx/dydxViews/dydxViews/SwiftUIHosting/HostingViewController.swift index 3de5701e4..40059174a 100644 --- a/dydx/dydxViews/dydxViews/SwiftUIHosting/HostingViewController.swift +++ b/dydx/dydxViews/dydxViews/SwiftUIHosting/HostingViewController.swift @@ -39,11 +39,6 @@ public struct HostingViewControllerConfiguration { open class HostingViewController: TrackingViewController, UIViewControllerEmbeddingProtocol { - open override var navigationEvent: TrackableEvent? { - guard let path = history?.path else { assertionFailure("no path?"); return nil } - return AnalyticsEventV2.navigatePage(page: .custom(path: path)) - } - private var hostingController: UIHostingController? private let presenterView = ObjectPresenterView() private var configuration: HostingViewControllerConfiguration = .default diff --git a/dydxV4/dydxV4.xcodeproj/project.pbxproj b/dydxV4/dydxV4.xcodeproj/project.pbxproj index 5e410929c..0ac6ba442 100644 --- a/dydxV4/dydxV4.xcodeproj/project.pbxproj +++ b/dydxV4/dydxV4.xcodeproj/project.pbxproj @@ -31,6 +31,7 @@ 02FF092F29ADBD9F00781EDA /* dydxChart.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 029E11EB29ADB9BC00FE271C /* dydxChart.framework */; }; 02FF093029ADBDA300781EDA /* dydxPresenters.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0293B66528CE94E200DDB103 /* dydxPresenters.framework */; }; 274F43062BA4C0B400645059 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 274F43052BA4C0B400645059 /* PrivacyInfo.xcprivacy */; }; + 27968BA92BF7AC7A002F2C34 /* TrackingViewController+Ext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27968BA82BF7AC7A002F2C34 /* TrackingViewController+Ext.swift */; }; 27ADEE6C2BC4A23400B8F1DB /* dydxSettingsStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27ADEE6B2BC4A23400B8F1DB /* dydxSettingsStore.swift */; }; 27D41AF12A8E9214009A2F37 /* UIApplication+URLHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27D41AF02A8E9214009A2F37 /* UIApplication+URLHandler.swift */; }; 27DBDD222A8FF5B2002383C6 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 27DBDCED2A8FF5B2002383C6 /* GoogleService-Info.plist */; }; @@ -798,6 +799,7 @@ 02E7DD9A28CFB31000727949 /* dydxStateManager.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = dydxStateManager.xcodeproj; path = ../dydx/dydxStateManager/dydxStateManager.xcodeproj; sourceTree = ""; }; 171807B0CCAE5C86B5D65793 /* Pods_iOS_dydxV4.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_iOS_dydxV4.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 274F43052BA4C0B400645059 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = ""; }; + 27968BA82BF7AC7A002F2C34 /* TrackingViewController+Ext.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "TrackingViewController+Ext.swift"; sourceTree = ""; }; 27ADEE6B2BC4A23400B8F1DB /* dydxSettingsStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = dydxSettingsStore.swift; sourceTree = ""; }; 27D41AF02A8E9214009A2F37 /* UIApplication+URLHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIApplication+URLHandler.swift"; sourceTree = ""; }; 27DBDCED2A8FF5B2002383C6 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; @@ -1292,6 +1294,7 @@ children = ( 64AF4810281880B100EBFDC6 /* dydxAmplitudeTracking.swift */, 02C7262A29D793C90098AFBC /* dydxCompositeTracking.swift */, + 27968BA82BF7AC7A002F2C34 /* TrackingViewController+Ext.swift */, ); path = _Tracking; sourceTree = ""; @@ -2317,6 +2320,7 @@ 27D41AF12A8E9214009A2F37 /* UIApplication+URLHandler.swift in Sources */, 02756A6A287CA33E00803741 /* dydxNotificationHandlerDelegate.swift in Sources */, 3112F463216BBF8400708927 /* AppDelegate.swift in Sources */, + 27968BA92BF7AC7A002F2C34 /* TrackingViewController+Ext.swift in Sources */, 27ADEE6C2BC4A23400B8F1DB /* dydxSettingsStore.swift in Sources */, 3101FC582511508800AC4010 /* CommonAppDelegate.swift in Sources */, 0217A0A129D78BD5007F31C5 /* dydxBiometricsLocalAuthenticator.swift in Sources */, diff --git a/dydxV4/dydxV4/AppDelegate.swift b/dydxV4/dydxV4/AppDelegate.swift index fb8e4c8c9..fb01c72a6 100644 --- a/dydxV4/dydxV4/AppDelegate.swift +++ b/dydxV4/dydxV4/AppDelegate.swift @@ -21,6 +21,7 @@ import RoutingKit import UIAppToolkits import UIToolkits import Utilities +import dydxAnalytics #if _iOS import FirebaseStaticInjections @@ -143,15 +144,7 @@ class AppDelegate: CommonAppDelegate { } override func deepLinkHandled(deeplink: URL, successful: Bool) { - let data = ["url": deeplink.absoluteString] - if successful { - if let type = deeplink.params?["notification_type"] { - Tracking.shared?.view("/notification/deeplink/" + type, data: data) - } - Tracking.shared?.view("/notification/deeplink/success", data: data) - } else { - Tracking.shared?.view("/notification/deeplink/failure", data: data) - } + Tracking.shared?.log(event: .deepLinkHandled(url: deeplink.absoluteString, succeeded: successful)) } /// Prioritized CoinbaseWalletSDK handling of the deeplink diff --git a/dydxV4/dydxV4/_Notification/dydxNotificationHandlerDelegate.swift b/dydxV4/dydxV4/_Notification/dydxNotificationHandlerDelegate.swift index eef89ebd7..2afdf3151 100644 --- a/dydxV4/dydxV4/_Notification/dydxNotificationHandlerDelegate.swift +++ b/dydxV4/dydxV4/_Notification/dydxNotificationHandlerDelegate.swift @@ -8,6 +8,7 @@ import Utilities import FirebaseMessaging +import dydxAnalytics final class dydxNotificationHandlerDelegate: NSObject, NotificationHandlerDelegate { @@ -62,14 +63,14 @@ final class dydxNotificationHandlerDelegate: NSObject, NotificationHandlerDelega if lastPermission != permission { if permission == .denied { if lastPermission == .notDetermined || lastPermission == .authorized { - Tracking.shared?.view("/notification/switch/denied", data: nil, from: nil, time: nil) + Tracking.shared?.log(event: .notificationPermissionsChanged(isAuthorized: false)) } if lastPermission == .authorized { // sendTokenDeletion() } } else if permission == .authorized { if lastPermission == .notDetermined || lastPermission == .denied { - Tracking.shared?.view("/notification/switch/authorized", data: nil, from: nil, time: nil) + Tracking.shared?.log(event: .notificationPermissionsChanged(isAuthorized: true)) } // sendTokenUpdate() } diff --git a/dydxV4/dydxV4/_Tracking/TrackingViewController+Ext.swift b/dydxV4/dydxV4/_Tracking/TrackingViewController+Ext.swift new file mode 100644 index 000000000..4346e08dd --- /dev/null +++ b/dydxV4/dydxV4/_Tracking/TrackingViewController+Ext.swift @@ -0,0 +1,58 @@ +// +// TrackingViewController+Ext.swift +// dydxV4 +// +// Created by Michael Maguire on 5/17/24. +// Copyright © 2024 dYdX Trading Inc. All rights reserved. +// + +import Utilities +import PlatformParticles + +extension TrackingViewController: ScreenIdentifiable { + public var mobilePath: String { + switch path { + case "/market", "/trade": + return "\(path)/\(marketId)" + default: + //TODO: replace default with all acceptable paths (this will force developers to add analytics and not forget) + //assertionFailure("add mobile path handling for \(history?.path)") + return path + } + } + + /// the web-equivalent web page (if there is a good match) + public var correspondingWebPath: String? { + switch path { + case "/market", "/trade": + // web does not have a /market/ path + return "trade/\(marketId)" + default: + return nil + } + } + + public var screenClass: String { + String(describing: type(of: self)) + } + +} + +// MARK: Convenience Accessors +private extension TrackingViewController { + private var path: String { + guard let path = history?.path else { + assertionFailure("no path for \(screenClass)") + return "" + } + return path + } + + private var marketId: String { + guard let marketId = history?.params?["market"] as? String else { + assertionFailure("no marketId for \(screenClass)") + return "" + } + return marketId + } +} diff --git a/dydxV4/dydxV4/_Tracking/dydxCompositeTracking.swift b/dydxV4/dydxV4/_Tracking/dydxCompositeTracking.swift index 460923f56..03941fb39 100644 --- a/dydxV4/dydxV4/_Tracking/dydxCompositeTracking.swift +++ b/dydxV4/dydxV4/_Tracking/dydxCompositeTracking.swift @@ -88,34 +88,34 @@ public class dydxCompositeTracking: CompositeTracking { - override public func view(_ path: String?, action: String?, data: [String: Any]?, from: String?, time: Date?, revenue: NSNumber?, contextViewController: UIViewController?) { - if let transformed = transform(events: viewEvents, path: path), let event = parser.asString(transformed["event"]) { - super.view(path, action: action, data: data, from: from, time: time, revenue: nil, contextViewController: contextViewController) - let info = parser.asDictionary(transformed["info"]) ?? data ?? [String: Any]() - log(event: event, data: info, revenue: revenue) - } else { - super.view(path, action: action, data: data, from: from, time: time, revenue: revenue, contextViewController: contextViewController) - } - if let contextViewController { - - log(event: AnalyticsEventScreenView, - data: [ - AnalyticsParameterScreenName: path as Any, - AnalyticsParameterScreenClass: String(describing: type(of: contextViewController)) - ]) - } - if let transformed = transform(events: onboardingEvents, path: path), let event = parser.asString(transformed["event"]) { - var info = parser.asDictionary(transformed["info"]) ?? data ?? [String: Any]() - if event == "OnboardingStepChanged" { - if let time = time, let previous = transform(events: onboardingEvents, path: from), parser.asString(transformed["event"]) == "OnboardingStepChanged" { - let seconds = Int(Date().timeIntervalSince(time)) - info["secondsOnPreviousStep"] = NSNumber(value: seconds) - info["previousStep"] = (previous["info"] as? [String: Any])?["currentStep"] - } - } - log(event: event, data: info, revenue: revenue) - } - } +// override public func view(_ path: String?, action: String?, data: [String: Any]?, from: String?, time: Date?, revenue: NSNumber?, contextViewController: UIViewController?) { +// if let transformed = transform(events: viewEvents, path: path), let event = parser.asString(transformed["event"]) { +// super.view(path, action: action, data: data, from: from, time: time, revenue: nil, contextViewController: contextViewController) +// let info = parser.asDictionary(transformed["info"]) ?? data ?? [String: Any]() +// log(event: event, data: info, revenue: revenue) +// } else { +// super.view(path, action: action, data: data, from: from, time: time, revenue: revenue, contextViewController: contextViewController) +// } +// if let contextViewController { +// +// log(event: AnalyticsEventScreenView, +// data: [ +// AnalyticsParameterScreenName: path as Any, +// AnalyticsParameterScreenClass: String(describing: type(of: contextViewController)) +// ]) +// } +// if let transformed = transform(events: onboardingEvents, path: path), let event = parser.asString(transformed["event"]) { +// var info = parser.asDictionary(transformed["info"]) ?? data ?? [String: Any]() +// if event == "OnboardingStepChanged" { +// if let time = time, let previous = transform(events: onboardingEvents, path: from), parser.asString(transformed["event"]) == "OnboardingStepChanged" { +// let seconds = Int(Date().timeIntervalSince(time)) +// info["secondsOnPreviousStep"] = NSNumber(value: seconds) +// info["previousStep"] = (previous["info"] as? [String: Any])?["currentStep"] +// } +// } +// log(event: event, data: info, revenue: revenue) +// } +// } override public func leave(_ path: String?) { super.leave(path)