Skip to content

Commit

Permalink
Revert "Release PR: Check for the negative attribution case (#3311)"
Browse files Browse the repository at this point in the history
This reverts commit dddd0e2.
  • Loading branch information
dus7 committed Sep 12, 2024
1 parent 966fa49 commit 101b907
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 18 deletions.
2 changes: 0 additions & 2 deletions Core/PixelEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,6 @@ extension Pixel {

// MARK: Apple Ad Attribution
case appleAdAttribution
case appleAdAttributionNotAttributed

// MARK: Secure Vault
case secureVaultL1KeyMigration
Expand Down Expand Up @@ -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"
Expand Down
22 changes: 11 additions & 11 deletions DuckDuckGo/AdAttribution/AdAttributionPixelReporter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
7 changes: 2 additions & 5 deletions DuckDuckGoTests/AdAttributionPixelReporterTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 101b907

Please sign in to comment.