From 101b90763c6b6cb791e90731465c73c3ce856a73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mariusz=20=C5=9Apiewak?= Date: Thu, 12 Sep 2024 17:09:56 +0200 Subject: [PATCH 1/2] Revert "Release PR: Check for the negative attribution case (#3311)" This reverts commit dddd0e255a59117727553781ff999cfba5d631e9. --- Core/PixelEvent.swift | 2 -- .../AdAttributionPixelReporter.swift | 22 +++++++++---------- .../AdAttributionPixelReporterTests.swift | 7 ++---- 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/Core/PixelEvent.swift b/Core/PixelEvent.swift index e5cb5bcdf9..2afe5960b8 100644 --- a/Core/PixelEvent.swift +++ b/Core/PixelEvent.swift @@ -725,7 +725,6 @@ extension Pixel { // MARK: Apple Ad Attribution case appleAdAttribution - case appleAdAttributionNotAttributed // MARK: Secure Vault case secureVaultL1KeyMigration @@ -1446,7 +1445,6 @@ extension Pixel.Event { // MARK: - Apple Ad Attribution case .appleAdAttribution: return "m_apple-ad-attribution" - case .appleAdAttributionNotAttributed: return "m_apple-ad-attribution_not-attributed" // MARK: - User behavior case .userBehaviorReloadTwiceWithin12Seconds: return "m_reload-twice-within-12-seconds" diff --git a/DuckDuckGo/AdAttribution/AdAttributionPixelReporter.swift b/DuckDuckGo/AdAttribution/AdAttributionPixelReporter.swift index 24811b6fd0..7e39be258c 100644 --- a/DuckDuckGo/AdAttribution/AdAttributionPixelReporter.swift +++ b/DuckDuckGo/AdAttribution/AdAttributionPixelReporter.swift @@ -56,17 +56,17 @@ final actor AdAttributionPixelReporter { } if let (token, attributionData) = await self.attributionFetcher.fetch() { - let event: Pixel.Event = attributionData.attribution ? .appleAdAttribution : .appleAdAttributionNotAttributed - let parameters = attributionData.attribution ? self.pixelParametersForAttribution(attributionData, attributionToken: token) : [:] - - do { - try await pixelFiring.fire( - pixel: event, - withAdditionalParameters: parameters, - includedParameters: [.appVersion, .atb] - ) - } catch { - return false + if attributionData.attribution { + let parameters = self.pixelParametersForAttribution(attributionData, attributionToken: token) + do { + try await pixelFiring.fire( + pixel: .appleAdAttribution, + withAdditionalParameters: parameters, + includedParameters: [.appVersion, .atb] + ) + } catch { + return false + } } await fetcherStorage.markAttributionReportSuccessful() diff --git a/DuckDuckGoTests/AdAttributionPixelReporterTests.swift b/DuckDuckGoTests/AdAttributionPixelReporterTests.swift index 1c6a2a6d7c..eb21f4507b 100644 --- a/DuckDuckGoTests/AdAttributionPixelReporterTests.swift +++ b/DuckDuckGoTests/AdAttributionPixelReporterTests.swift @@ -124,16 +124,13 @@ final class AdAttributionPixelReporterTests: XCTestCase { XCTAssertNil(pixelAttributes["ad_id"]) } - func testNotAttributedPixelFiredAndMarkedReported_WhenAttributionFalse() async throws { + func testPixelNotFiredAndMarksReport_WhenAttributionFalse() async { let sut = createSUT() attributionFetcher.fetchResponse = ("example", AdServicesAttributionResponse(attribution: false)) let result = await sut.reportAttributionIfNeeded() - let pixelAttributes = try XCTUnwrap(PixelFiringMock.lastParams) - - XCTAssertEqual(pixelAttributes, [:]) - XCTAssertEqual(PixelFiringMock.lastPixel?.name, "m_apple-ad-attribution_not-attributed") + XCTAssertNil(PixelFiringMock.lastPixel) XCTAssertTrue(fetcherStorage.wasAttributionReportSuccessful) XCTAssertTrue(result) } From ffead581721a4d3f8dfac4b97ade5e23c63803fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mariusz=20=C5=9Apiewak?= Date: Thu, 12 Sep 2024 17:11:19 +0200 Subject: [PATCH 2/2] Turn off Ad attribution reporting --- DuckDuckGo/AdAttribution/AdAttributionPixelReporter.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DuckDuckGo/AdAttribution/AdAttributionPixelReporter.swift b/DuckDuckGo/AdAttribution/AdAttributionPixelReporter.swift index 7e39be258c..a09eb9d693 100644 --- a/DuckDuckGo/AdAttribution/AdAttributionPixelReporter.swift +++ b/DuckDuckGo/AdAttribution/AdAttributionPixelReporter.swift @@ -22,7 +22,7 @@ import Core final actor AdAttributionPixelReporter { - static let isAdAttributionReportingEnabled = true + static let isAdAttributionReportingEnabled = false static var shared = AdAttributionPixelReporter()