diff --git a/DuckDuckGo/NavigationBar/View/MoreOptionsMenu.swift b/DuckDuckGo/NavigationBar/View/MoreOptionsMenu.swift index 26fc57d85b..85798ce8aa 100644 --- a/DuckDuckGo/NavigationBar/View/MoreOptionsMenu.swift +++ b/DuckDuckGo/NavigationBar/View/MoreOptionsMenu.swift @@ -251,7 +251,6 @@ final class MoreOptionsMenu: NSMenu { #if SUBSCRIPTION @objc func openSubscriptionPurchasePage(_ sender: NSMenuItem) { - Pixel.fire(.privacyProOfferScreenImpression) actionDelegate?.optionsButtonMenuRequestedSubscriptionPurchasePage(self) } diff --git a/DuckDuckGo/Tab/UserScripts/SubscriptionPagesUserScript.swift b/DuckDuckGo/Tab/UserScripts/SubscriptionPagesUserScript.swift index f270783d8d..b7a4e3afc4 100644 --- a/DuckDuckGo/Tab/UserScripts/SubscriptionPagesUserScript.swift +++ b/DuckDuckGo/Tab/UserScripts/SubscriptionPagesUserScript.swift @@ -398,10 +398,6 @@ final class SubscriptionPagesUseSubscriptionFeature: Subfeature { if isBackendError { DailyPixel.fire(pixel: .privacyProPurchaseFailureBackendError, frequency: .dailyAndCount) } - - if subscriptionActivationError != .hasActiveSubscription && subscriptionActivationError != .cancelledByUser { - DailyPixel.fire(pixel: .privacyProPurchaseFailure, frequency: .dailyAndCount) - } } func activateSubscription(params: Any, original: WKScriptMessage) async throws -> Encodable? { @@ -577,6 +573,7 @@ extension MainWindowController { @MainActor func showSomethingWentWrongAlert() { + DailyPixel.fire(pixel: .privacyProPurchaseFailure, frequency: .dailyAndCount) guard let window else { return } window.show(.somethingWentWrongAlert()) diff --git a/DuckDuckGo/Windows/View/WindowControllersManager.swift b/DuckDuckGo/Windows/View/WindowControllersManager.swift index 92a871a208..d6faab0dee 100644 --- a/DuckDuckGo/Windows/View/WindowControllersManager.swift +++ b/DuckDuckGo/Windows/View/WindowControllersManager.swift @@ -185,6 +185,9 @@ extension WindowControllersManager { } func showTab(with content: Tab.TabContent) { + + reportTabOpening(with: content) + guard let windowController = self.mainWindowController else { let tabCollection = TabCollection(tabs: [Tab(content: content)]) let tabCollectionViewModel = TabCollectionViewModel(tabCollection: tabCollection) @@ -198,6 +201,14 @@ extension WindowControllersManager { windowController.window?.orderFront(nil) } + func reportTabOpening(with content: Tab.TabContent) { + switch content { + case .subscription(let uRL): + Pixel.fire(.privacyProOfferScreenImpression) + default: break + } + } + // MARK: - VPN #if NETWORK_PROTECTION diff --git a/LocalPackages/SubscriptionUI/Sources/SubscriptionUI/Preferences/PreferencesSubscriptionModel.swift b/LocalPackages/SubscriptionUI/Sources/SubscriptionUI/Preferences/PreferencesSubscriptionModel.swift index c2cd52eba6..c48b3d12a0 100644 --- a/LocalPackages/SubscriptionUI/Sources/SubscriptionUI/Preferences/PreferencesSubscriptionModel.swift +++ b/LocalPackages/SubscriptionUI/Sources/SubscriptionUI/Preferences/PreferencesSubscriptionModel.swift @@ -225,6 +225,7 @@ public final class PreferencesSubscriptionModel: ObservableObject { @MainActor func removeFromThisDeviceAction() { + userEventHandler(.removeSubscriptionClick) accountManager.signOut() } diff --git a/LocalPackages/SubscriptionUI/Sources/SubscriptionUI/Preferences/PreferencesSubscriptionView.swift b/LocalPackages/SubscriptionUI/Sources/SubscriptionUI/Preferences/PreferencesSubscriptionView.swift index 5424f3920b..e60ee92935 100644 --- a/LocalPackages/SubscriptionUI/Sources/SubscriptionUI/Preferences/PreferencesSubscriptionView.swift +++ b/LocalPackages/SubscriptionUI/Sources/SubscriptionUI/Preferences/PreferencesSubscriptionView.swift @@ -125,7 +125,6 @@ public struct PreferencesSubscriptionView: View { } }) Button(UserText.removeFromThisDeviceButton, action: { - model.userEventHandler(.removeSubscriptionClick) showingRemoveConfirmationDialog.toggle() }) } label: { @@ -189,7 +188,6 @@ public struct PreferencesSubscriptionView: View { .buttonStyle(DefaultActionButtonStyle(enabled: true)) Menu { Button(UserText.removeFromThisDeviceButton, action: { - model.userEventHandler(.removeSubscriptionClick) showingRemoveConfirmationDialog.toggle() }) } label: {