From 7be953f4326307b99d0962bca6b9726ba06ea934 Mon Sep 17 00:00:00 2001 From: Sabrina Tardio <44158575+SabrinaTardio@users.noreply.github.com> Date: Sat, 13 Jul 2024 00:01:35 +0200 Subject: [PATCH] Sabrina/check allocated cohort (#2973) Task/Issue URL: https://app.asana.com/0/1199230911884351/1207799610561089/f **Description**: Check the cohort has been allocated before trying to access it --- DuckDuckGo/Statistics/Experiment/PixelExperiment.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/DuckDuckGo/Statistics/Experiment/PixelExperiment.swift b/DuckDuckGo/Statistics/Experiment/PixelExperiment.swift index 71f0705f03..54739261d8 100644 --- a/DuckDuckGo/Statistics/Experiment/PixelExperiment.swift +++ b/DuckDuckGo/Statistics/Experiment/PixelExperiment.swift @@ -208,7 +208,11 @@ final internal class PixelExperimentLogic { } func fireSerpPixel() { - PixelKit.fire(GeneralPixel.serp(cohort: cohort?.rawValue), frequency: .standard, includeAppVersionParameter: false) + if allocatedCohort != nil { + PixelKit.fire(GeneralPixel.serp(cohort: cohort?.rawValue), frequency: .standard, includeAppVersionParameter: false) + } else { + PixelKit.fire(GeneralPixel.serp(cohort: nil), frequency: .standard, includeAppVersionParameter: false) + } } func fireOnboardingHomeButtonEnabledPixel() {