From f1a033cc4b97ab6b4d845815e825ba179c02635a Mon Sep 17 00:00:00 2001 From: Maxim Tsoy Date: Fri, 18 Oct 2024 10:09:25 +0200 Subject: [PATCH] Second macOS CPM experiment (#1017) Please review the release process for BrowserServicesKit [here](https://app.asana.com/0/1200194497630846/1200837094583426). **Required**: Task/Issue URL: https://app.asana.com/0/1205142657210376/1208488711477099/f iOS PR: macOS PR: https://github.com/duckduckgo/macos-browser/pull/3397 What kind of version bump will this require?: Major/Minor/Patch **Optional**: Tech Design URL: https://app.asana.com/0/1205142657210376/1208527766092596/f CC: @ayoy **Description**: This PR cleans up the previous experiment (#937), and creates a new subfeature for the new experiment. The experiment logic will be in the macOS PR. **Steps to test this PR**: 1. 1. **OS Testing**: * [ ] iOS 14 * [ ] iOS 15 * [ ] iOS 16 * [ ] macOS 10.15 * [ ] macOS 11 * [ ] macOS 12 --- ###### Internal references: [Software Engineering Expectations](https://app.asana.com/0/59792373528535/199064865822552) [Technical Design Template](https://app.asana.com/0/59792373528535/184709971311943) --- .../AdClickAttributionDetection.swift | 10 ++-------- .../AdClickAttribution/AdClickAttributionEvents.swift | 1 - .../AdClickAttribution/AdClickAttributionLogic.swift | 8 ++------ .../PrivacyConfig/Features/PrivacyFeature.swift | 2 +- 4 files changed, 5 insertions(+), 16 deletions(-) diff --git a/Sources/BrowserServicesKit/ContentBlocking/AdClickAttribution/AdClickAttributionDetection.swift b/Sources/BrowserServicesKit/ContentBlocking/AdClickAttribution/AdClickAttributionDetection.swift index ccbf5ba2f..3677b2744 100644 --- a/Sources/BrowserServicesKit/ContentBlocking/AdClickAttribution/AdClickAttributionDetection.swift +++ b/Sources/BrowserServicesKit/ContentBlocking/AdClickAttribution/AdClickAttributionDetection.swift @@ -42,20 +42,17 @@ public class AdClickAttributionDetection { private let tld: TLD private let eventReporting: EventMapping? private let errorReporting: EventMapping? - private let cpmExperimentOn: Bool? public weak var delegate: AdClickAttributionDetectionDelegate? public init(feature: AdClickAttributing, tld: TLD, eventReporting: EventMapping? = nil, - errorReporting: EventMapping? = nil, - cpmExperimentOn: Bool? = nil) { + errorReporting: EventMapping? = nil) { self.attributionFeature = feature self.tld = tld self.eventReporting = eventReporting self.errorReporting = errorReporting - self.cpmExperimentOn = cpmExperimentOn } // MARK: - Public API @@ -146,12 +143,9 @@ public class AdClickAttributionDetection { domainDetection = "none" } - var parameters = [AdClickAttributionEvents.Parameters.domainDetection: domainDetection, + let parameters = [AdClickAttributionEvents.Parameters.domainDetection: domainDetection, AdClickAttributionEvents.Parameters.domainDetectionEnabled: attributionFeature.isDomainDetectionEnabled ? "1" : "0", AdClickAttributionEvents.Parameters.heuristicDetectionEnabled: attributionFeature.isHeuristicDetectionEnabled ? "1" : "0"] - if let cpmExperimentOn { - parameters[AdClickAttributionEvents.Parameters.cpmExperiment] = cpmExperimentOn ? "1" : "0" - } eventReporting?.fire(.adAttributionDetected, parameters: parameters) } } diff --git a/Sources/BrowserServicesKit/ContentBlocking/AdClickAttribution/AdClickAttributionEvents.swift b/Sources/BrowserServicesKit/ContentBlocking/AdClickAttribution/AdClickAttributionEvents.swift index e97926672..46f24a87c 100644 --- a/Sources/BrowserServicesKit/ContentBlocking/AdClickAttribution/AdClickAttributionEvents.swift +++ b/Sources/BrowserServicesKit/ContentBlocking/AdClickAttribution/AdClickAttributionEvents.swift @@ -25,7 +25,6 @@ public enum AdClickAttributionEvents { public static let heuristicDetectionEnabled = "heuristicDetectionEnabled" public static let domainDetectionEnabled = "domainDetectionEnabled" public static let count = "count" - public static let cpmExperiment = "cpmExperiment" } case adAttributionDetected diff --git a/Sources/BrowserServicesKit/ContentBlocking/AdClickAttribution/AdClickAttributionLogic.swift b/Sources/BrowserServicesKit/ContentBlocking/AdClickAttribution/AdClickAttributionLogic.swift index eb8e32104..dd3d8b532 100644 --- a/Sources/BrowserServicesKit/ContentBlocking/AdClickAttribution/AdClickAttributionLogic.swift +++ b/Sources/BrowserServicesKit/ContentBlocking/AdClickAttribution/AdClickAttributionLogic.swift @@ -207,15 +207,11 @@ public class AdClickAttributionLogic { } } - public func onRequestDetected(request: DetectedRequest, cpmExperimentOn: Bool? = nil) { + public func onRequestDetected(request: DetectedRequest) { guard registerFirstActivity, BlockingState.allowed(reason: .adClickAttribution) == request.state else { return } - var parameters: [String: String] = [:] - if let cpmExperimentOn { - parameters[AdClickAttributionEvents.Parameters.cpmExperiment] = cpmExperimentOn ? "1" : "0" - } - eventReporting?.fire(.adAttributionActive, parameters: parameters) + eventReporting?.fire(.adAttributionActive) registerFirstActivity = false } diff --git a/Sources/BrowserServicesKit/PrivacyConfig/Features/PrivacyFeature.swift b/Sources/BrowserServicesKit/PrivacyConfig/Features/PrivacyFeature.swift index d49e7dd1e..a55aea837 100644 --- a/Sources/BrowserServicesKit/PrivacyConfig/Features/PrivacyFeature.swift +++ b/Sources/BrowserServicesKit/PrivacyConfig/Features/PrivacyFeature.swift @@ -123,7 +123,7 @@ public enum AutoconsentSubfeature: String, PrivacySubfeature { } case onByDefault - case filterlistExperiment + case filterlistExperiment2 } public enum PrivacyProSubfeature: String, Equatable, PrivacySubfeature {