Skip to content

Commit

Permalink
fix search pixel (#2971)
Browse files Browse the repository at this point in the history
Task/Issue URL:
https://app.asana.com/0/1199230911884351/1207784623692350/f

Description: Will fire the pixel even when no cohort present
  • Loading branch information
SabrinaTardio authored Jul 12, 2024
1 parent 5349b00 commit cf84537
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions DuckDuckGo/Application/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -280,11 +280,10 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
_ = DownloadListCoordinator.shared
_ = RecentlyClosedCoordinator.shared

PixelExperiment.install()

if LocalStatisticsStore().atb == nil {
AppDelegate.firstLaunchDate = Date()
// MARK: Enable pixel experiments here
PixelExperiment.install()
}
AtbAndVariantCleanup.cleanup()
DefaultVariantManager().assignVariantIfNeeded { _ in
Expand Down
3 changes: 1 addition & 2 deletions DuckDuckGo/Statistics/Experiment/PixelExperiment.swift
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,7 @@ final internal class PixelExperimentLogic {
}

func fireSerpPixel() {
guard allocatedCohort != nil, let cohort else { return }
PixelKit.fire(GeneralPixel.serp(cohort: cohort.rawValue), frequency: .standard, includeAppVersionParameter: false)
PixelKit.fire(GeneralPixel.serp(cohort: cohort?.rawValue), frequency: .standard, includeAppVersionParameter: false)
}

func fireOnboardingHomeButtonEnabledPixel() {
Expand Down
3 changes: 2 additions & 1 deletion DuckDuckGo/Statistics/GeneralPixel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ enum GeneralPixel: PixelKitEventV2 {
case compileRulesWait(onboardingShown: OnboardingShown, waitTime: CompileRulesWaitTime, result: WaitResult)
case launchInitial(cohort: String)

case serp(cohort: String)
case serp(cohort: String?)
case serpInitial(cohort: String)
case serpDay21to27(cohort: String)

Expand Down Expand Up @@ -1005,6 +1005,7 @@ enum GeneralPixel: PixelKitEventV2 {
return [PixelKit.Parameters.experimentCohort: cohort]

case .serp(let cohort):
guard let cohort else { return [:] }
return [PixelKit.Parameters.experimentCohort: cohort]

case .serpInitial(let cohort):
Expand Down

0 comments on commit cf84537

Please sign in to comment.