Skip to content

Commit 540ddc3

Browse files
Send experiment cohorts in feedback form (#6544)
Task/Issue URL: https://app.asana.com/1/137249556945/task/1210930516193739?focus=true ### Description This PR adds the onboarding experiment cohort as part of the atb when sending feedback ### Steps to test this PR - [x] Setup the experiment so when you install the app you are enrolled. - [x] Send feedback via the feedback form. - [x] Check the pixel contains the atb parameter including "_yourCohort" - [x] Clear data and re-install this time without setting the experiment up. - [x] Send feedback via the feedback form - [x] The pixel should only contain the atb without any cohorts
1 parent 8880843 commit 540ddc3

File tree

4 files changed

+22
-1
lines changed

4 files changed

+22
-1
lines changed

app/src/main/java/com/duckduckgo/app/di/NetworkModule.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import com.duckduckgo.app.feedback.api.FeedbackSubmitter
2222
import com.duckduckgo.app.feedback.api.FireAndForgetFeedbackSubmitter
2323
import com.duckduckgo.app.feedback.api.SubReasonApiMapper
2424
import com.duckduckgo.app.global.api.*
25+
import com.duckduckgo.app.onboardingdesignexperiment.OnboardingDesignExperimentManager
2526
import com.duckduckgo.app.statistics.pixels.Pixel
2627
import com.duckduckgo.app.statistics.store.StatisticsDataStore
2728
import com.duckduckgo.appbuildconfig.api.AppBuildConfig
@@ -172,6 +173,7 @@ class NetworkModule {
172173
@AppCoroutineScope appCoroutineScope: CoroutineScope,
173174
appBuildConfig: AppBuildConfig,
174175
dispatcherProvider: DispatcherProvider,
176+
onboardingDesignExperimentManager: OnboardingDesignExperimentManager,
175177
): FeedbackSubmitter =
176178
FireAndForgetFeedbackSubmitter(
177179
feedbackService,
@@ -182,6 +184,7 @@ class NetworkModule {
182184
appCoroutineScope,
183185
appBuildConfig,
184186
dispatcherProvider,
187+
onboardingDesignExperimentManager,
185188
)
186189

187190
companion object {

app/src/main/java/com/duckduckgo/app/feedback/api/FeedbackSubmitter.kt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import com.duckduckgo.app.feedback.ui.negative.FeedbackType.MainReason.OTHER
2525
import com.duckduckgo.app.feedback.ui.negative.FeedbackType.MainReason.SEARCH_NOT_GOOD_ENOUGH
2626
import com.duckduckgo.app.feedback.ui.negative.FeedbackType.MainReason.WEBSITES_NOT_LOADING
2727
import com.duckduckgo.app.feedback.ui.negative.FeedbackType.SubReason
28+
import com.duckduckgo.app.onboardingdesignexperiment.OnboardingDesignExperimentManager
2829
import com.duckduckgo.app.pixels.AppPixelName
2930
import com.duckduckgo.app.pixels.AppPixelName.FEEDBACK_NEGATIVE_SUBMISSION
3031
import com.duckduckgo.app.statistics.pixels.Pixel
@@ -65,6 +66,7 @@ class FireAndForgetFeedbackSubmitter(
6566
private val appCoroutineScope: CoroutineScope,
6667
private val appBuildConfig: AppBuildConfig,
6768
private val dispatcherProvider: DispatcherProvider,
69+
private val onboardingDesignExperimentManager: OnboardingDesignExperimentManager,
6870
) : FeedbackSubmitter {
6971
override suspend fun sendNegativeFeedback(
7072
mainReason: MainReason,
@@ -148,6 +150,13 @@ class FireAndForgetFeedbackSubmitter(
148150
url: String? = null,
149151
reason: String = FeedbackService.REASON_GENERAL,
150152
) {
153+
// Delete after the experiment has finished and go back to always return atbWithVariant()
154+
val atb = if (onboardingDesignExperimentManager.isAnyExperimentEnrolledAndEnabled()) {
155+
atbWithVariant() + "_${onboardingDesignExperimentManager.getCohort()}"
156+
} else {
157+
atbWithVariant()
158+
}
159+
151160
feedbackService.submitFeedback(
152161
reason = reason,
153162
category = category,
@@ -159,7 +168,7 @@ class FireAndForgetFeedbackSubmitter(
159168
manufacturer = Build.MANUFACTURER,
160169
model = Build.MODEL,
161170
api = appBuildConfig.sdkInt,
162-
atb = atbWithVariant(),
171+
atb = atb,
163172
)
164173
}
165174

app/src/main/java/com/duckduckgo/app/onboardingdesignexperiment/OnboardingDesignExperimentManager.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ interface OnboardingDesignExperimentManager {
6363
suspend fun fireOptionSelectedPixel(cta: Cta, index: Int)
6464
suspend fun fireSiteSuggestionOptionSelectedPixel(index: Int)
6565
suspend fun onWebPageFinishedLoading(url: String?)
66+
fun getCohort(): String?
6667
}
6768

6869
@ContributesMultibinding(
@@ -105,6 +106,10 @@ class RealOnboardingDesignExperimentManager @Inject constructor(
105106
}
106107
}
107108

109+
override fun getCohort(): String? {
110+
return onboardingDesignExperimentCohort?.cohortName
111+
}
112+
108113
/**
109114
* Enrolls the user in the onboarding design experiment if they are eligible.
110115
* Eligibility is determined by the device's Android version, form factor, and whether the user is a returning user.

app/src/test/java/com/duckduckgo/app/settings/clear/OnboardingExperimentFireAnimationHelperTest.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ class OnboardingExperimentFireAnimationHelperTest {
7272
var buckEnabled = false
7373
var modifiedControlEnabled = false
7474

75+
override fun getCohort(): String? {
76+
TODO("Not yet implemented")
77+
}
78+
7579
override suspend fun enroll() {
7680
TODO("Not yet implemented")
7781
}

0 commit comments

Comments
 (0)