Skip to content

Commit

Permalink
Update SERP and YT overlay pixel logic
Browse files Browse the repository at this point in the history
  • Loading branch information
afterxleep committed Oct 30, 2024
1 parent 9433591 commit a94c498
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions DuckDuckGo/DuckPlayer/DuckPlayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -399,27 +399,29 @@ final class DuckPlayer: DuckPlayerControlling {
return
}

// Based on the URL, determine which pixels to fire
let isSERP = url.isDuckDuckGoSearch

var event: Pixel.Event
if isSERP {
// Assume we are in the SERP Overlay
if isSERP {
switch userValues.duckPlayerMode {
case .enabled:
event = .duckPlayerSettingsAlwaysOverlaySERP
default:
event = .duckPlayerSettingsNeverOverlaySERP
Pixel.fire(pixel: .duckPlayerSettingsAlwaysOverlaySERP)
case .disabled:
Pixel.fire(pixel: .duckPlayerSettingsNeverOverlaySERP)
default: break
}

// Assume we are in the Youtube Overlay
} else {
switch userValues.duckPlayerMode {
case .enabled:
event = .duckPlayerSettingsAlwaysOverlayYoutube
default:
event = .duckPlayerSettingsNeverOverlayYoutube
Pixel.fire(pixel: .duckPlayerSettingsAlwaysOverlayYoutube)
case .disabled:
Pixel.fire(pixel: .duckPlayerSettingsNeverOverlayYoutube)
default: break
}
}

Pixel.fire(pixel: event)


}

Expand Down

0 comments on commit a94c498

Please sign in to comment.