Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Second macOS CPM experiment #1017

Merged
merged 3 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,17 @@ public class AdClickAttributionDetection {
private let tld: TLD
private let eventReporting: EventMapping<AdClickAttributionEvents>?
private let errorReporting: EventMapping<AdClickAttributionDebugEvents>?
private let cpmExperimentOn: Bool?

public weak var delegate: AdClickAttributionDetectionDelegate?

public init(feature: AdClickAttributing,
tld: TLD,
eventReporting: EventMapping<AdClickAttributionEvents>? = nil,
errorReporting: EventMapping<AdClickAttributionDebugEvents>? = nil,
cpmExperimentOn: Bool? = nil) {
errorReporting: EventMapping<AdClickAttributionDebugEvents>? = nil) {
self.attributionFeature = feature
self.tld = tld
self.eventReporting = eventReporting
self.errorReporting = errorReporting
self.cpmExperimentOn = cpmExperimentOn
}

// MARK: - Public API
Expand Down Expand Up @@ -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)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public enum AutoconsentSubfeature: String, PrivacySubfeature {
}

case onByDefault
case filterlistExperiment
case filterlistExperiment2
}

public enum PrivacyProSubfeature: String, Equatable, PrivacySubfeature {
Expand Down
Loading