diff --git a/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 42fd9da7d2..e347e28c1d 100644 --- a/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -15,7 +15,7 @@ "location" : "https://github.com/duckduckgo/BrowserServicesKit", "state" : { "branch" : "shane/form-updates", - "revision" : "1e17576d5612a64ee9eea8243ab62b766a4418c2" + "revision" : "96072e2e2a5ccee1e602482a5407cae17cbf861d" } }, { @@ -78,7 +78,7 @@ "location" : "https://github.com/duckduckgo/privacy-dashboard", "state" : { "branch" : "shane/form-updates", - "revision" : "aa3706033d41a650917ea118987ef7125d6cf52a" + "revision" : "7dc7e171e5bc2d3c540a6e8cb38c337f1e7a6869" } }, { diff --git a/DuckDuckGo/PrivacyDashboard/View/PrivacyDashboardViewController.swift b/DuckDuckGo/PrivacyDashboard/View/PrivacyDashboardViewController.swift index 538096a36e..55dfa66272 100644 --- a/DuckDuckGo/PrivacyDashboard/View/PrivacyDashboardViewController.swift +++ b/DuckDuckGo/PrivacyDashboard/View/PrivacyDashboardViewController.swift @@ -171,16 +171,18 @@ final class PrivacyDashboardViewController: NSViewController { extension PrivacyDashboardViewController: PrivacyDashboardControllerDelegate { - func privacyDashboardController(_ privacyDashboardController: PrivacyDashboardController, didChangeProtectionSwitch isEnabled: Bool) { + func privacyDashboardController(_ privacyDashboardController: PrivacyDashboardController, didChangeProtectionSwitch protectionState: ProtectionState) { guard let domain = privacyDashboardController.privacyInfo?.url.host else { return } let configuration = ContentBlocking.shared.privacyConfigurationManager.privacyConfig - if isEnabled && configuration.isUserUnprotected(domain: domain) { + if protectionState.isProtected && configuration.isUserUnprotected(domain: domain) { configuration.userEnabledProtection(forDomain: domain) + Pixel.fire(.dashboardProtectionAllowlistRemove(triggerOrigin: protectionState.eventOrigin.screen.rawValue)) } else { configuration.userDisabledProtection(forDomain: domain) + Pixel.fire(.dashboardProtectionAllowlistAdd(triggerOrigin: protectionState.eventOrigin.screen.rawValue)) } let completionToken = ContentBlocking.shared.contentBlockingManager.scheduleCompilation() diff --git a/DuckDuckGo/Statistics/PixelEvent.swift b/DuckDuckGo/Statistics/PixelEvent.swift index fe358736fe..ba43525cb2 100644 --- a/DuckDuckGo/Statistics/PixelEvent.swift +++ b/DuckDuckGo/Statistics/PixelEvent.swift @@ -149,6 +149,10 @@ extension Pixel { case duckPlayerSettingNever case duckPlayerSettingBackToDefault + // Dashboard + case dashboardProtectionAllowlistAdd(triggerOrigin: String?) + case dashboardProtectionAllowlistRemove(triggerOrigin: String?) + // Network Protection Waitlist case networkProtectionWaitlistUserActive case networkProtectionWaitlistEntryPointMenuItemDisplayed @@ -457,6 +461,13 @@ extension Pixel.Event { return "m_mac_duck-player_setting_never" case .duckPlayerSettingBackToDefault: return "m_mac_duck-player_setting_back-to-default" + case .duckPlayerSettingBackToDefault: + return "m_mac_duck-player_setting_back-to-default" + + case .dashboardProtectionAllowlistAdd(let triggerOrigin): + return "m_mac_mp_wla" + case .dashboardProtectionAllowlistRemove(let triggerOrigin): + return "m_mac_mp_wlr" case .launchInitial: return "m.mac.first-launch" diff --git a/DuckDuckGo/Statistics/PixelParameters.swift b/DuckDuckGo/Statistics/PixelParameters.swift index 1fcb87e97e..cc57f167c5 100644 --- a/DuckDuckGo/Statistics/PixelParameters.swift +++ b/DuckDuckGo/Statistics/PixelParameters.swift @@ -49,6 +49,14 @@ extension Pixel.Event { case .dailyPixel(let pixel, isFirst: _): return pixel.parameters + case .dashboardProtectionAllowlistAdd(let triggerOrigin): + guard let trigger = triggerOrigin else { return nil } + return [PixelKit.Parameters.dashboardTriggerOrigin: trigger] + + case .dashboardProtectionAllowlistRemove(let triggerOrigin): + guard let trigger = triggerOrigin else { return nil } + return [PixelKit.Parameters.dashboardTriggerOrigin: trigger] + // Don't use default to force new items to be thought about case .crash, .brokenSiteReport, diff --git a/LocalPackages/PixelKit/Sources/PixelKit/PixelKit+Parameters.swift b/LocalPackages/PixelKit/Sources/PixelKit/PixelKit+Parameters.swift index 6d5d65c57d..e3ab83f59d 100644 --- a/LocalPackages/PixelKit/Sources/PixelKit/PixelKit+Parameters.swift +++ b/LocalPackages/PixelKit/Sources/PixelKit/PixelKit+Parameters.swift @@ -53,6 +53,9 @@ public extension PixelKit { // Pixel experiments public static let experimentCohort = "cohort" + + // Dashboard + public static let dashboardTriggerOrigin = "trigger_origin" } enum Values {