diff --git a/dydx/dydxAnalytics/dydxAnalytics/AnalyticsEvent.swift b/dydx/dydxAnalytics/dydxAnalytics/AnalyticsEvent.swift index 9770fb78c..cbe55098f 100644 --- a/dydx/dydxAnalytics/dydxAnalytics/AnalyticsEvent.swift +++ b/dydx/dydxAnalytics/dydxAnalytics/AnalyticsEvent.swift @@ -55,6 +55,7 @@ public extension AnalyticsEventV2 { 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 { @@ -67,6 +68,8 @@ public extension AnalyticsEventV2 { return "/market/\(market)" case .addSlTp: return "/trade/take_profit_stop_loss" + case .custom(let path): + return path } } @@ -75,6 +78,8 @@ public extension AnalyticsEventV2 { 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 diff --git a/dydx/dydxViews/dydxViews/SwiftUIHosting/HostingViewController.swift b/dydx/dydxViews/dydxViews/SwiftUIHosting/HostingViewController.swift index 1a6c32622..3de5701e4 100644 --- a/dydx/dydxViews/dydxViews/SwiftUIHosting/HostingViewController.swift +++ b/dydx/dydxViews/dydxViews/SwiftUIHosting/HostingViewController.swift @@ -16,6 +16,7 @@ import UIToolkits import PlatformRouting import FloatingPanel import Utilities + import dydxAnalytics public struct HostingViewControllerConfiguration { public init(ignoreSafeArea: Bool = true, fixedHeight: CGFloat? = nil, gradientTabbar: Bool = false, disableNavigationController: Bool = false) { @@ -38,6 +39,11 @@ 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