Skip to content

Commit

Permalink
Added privacy pro subscription origin per cohort
Browse files Browse the repository at this point in the history
  • Loading branch information
nalcalag committed Nov 8, 2024
1 parent 4a0f2fa commit 607fbe0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3655,9 +3655,12 @@ class BrowserTabViewModel @Inject constructor(
private fun onDaxBubbleCtaOkButtonClicked(cta: DaxBubbleCta): Command? {
onUserDismissedCta(cta)
return when (cta) {
is DaxBubbleCta.DaxPrivacyProCta, is DaxBubbleCta.DaxExperimentPrivacyProCta -> LaunchPrivacyPro(
"https://duckduckgo.com/pro?origin=funnel_pro_android_onboarding".toUri(),
)
is DaxBubbleCta.DaxPrivacyProCta, is DaxBubbleCta.DaxExperimentPrivacyProCta -> {
val cohortOrigin = ctaViewModel.getCohortOrigin()
LaunchPrivacyPro(
"https://duckduckgo.com/pro?origin=funnel_pro_android_onboarding$cohortOrigin".toUri(),
)
}
is DaxBubbleCta.DaxEndCta, is DaxBubbleCta.DaxExperimentEndCta -> {
viewModelScope.launch {
val updatedCta = refreshCta()
Expand Down
14 changes: 13 additions & 1 deletion app/src/main/java/com/duckduckgo/app/cta/ui/CtaViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ import com.duckduckgo.app.global.model.domain
import com.duckduckgo.app.global.model.orderedTrackerBlockedEntities
import com.duckduckgo.app.onboarding.store.*
import com.duckduckgo.app.onboarding.ui.page.extendedonboarding.ExtendedOnboardingFeatureToggles
import com.duckduckgo.app.onboarding.ui.page.extendedonboarding.ExtendedOnboardingFeatureToggles.Cohorts
import com.duckduckgo.app.onboarding.ui.page.extendedonboarding.ExtendedOnboardingPixelsPlugin
import com.duckduckgo.app.onboarding.ui.page.extendedonboarding.HighlightsOnboardingExperimentManager
import com.duckduckgo.app.onboarding.ui.page.extendedonboarding.testPrivacyProOnboardingPrimaryButtonMetricPixel
import com.duckduckgo.app.onboarding.ui.page.extendedonboarding.testPrivacyProOnboardingSecondaryButtonMetricPixel
import com.duckduckgo.app.onboarding.ui.page.extendedonboarding.testPrivacyProOnboardingShownMetricPixel
import com.duckduckgo.app.pixels.AppPixelName.ONBOARDING_SKIP_MAJOR_NETWORK_UNIQUE
import com.duckduckgo.app.privacy.db.UserAllowListRepository
Expand Down Expand Up @@ -186,7 +188,7 @@ class CtaViewModel @Inject constructor(
suspend fun onUserClickCtaSkipButton(cta: Cta) {
withContext(dispatchers.io()) {
if (cta is DaxBubbleCta.DaxPrivacyProCta || cta is DaxBubbleCta.DaxExperimentPrivacyProCta) {
extendedOnboardingPixelsPlugin.testPrivacyProOnboardingPrimaryButtonMetricPixel()?.getPixelDefinitions()?.forEach {
extendedOnboardingPixelsPlugin.testPrivacyProOnboardingSecondaryButtonMetricPixel()?.getPixelDefinitions()?.forEach {
pixel.fire(it.pixelName, it.params)
}
}
Expand Down Expand Up @@ -503,6 +505,16 @@ class CtaViewModel @Inject constructor(

fun isSuggestedSiteOption(query: String): Boolean = onboardingStore.getSitesOptions().map { it.link }.contains(query)

fun getCohortOrigin(): String {
return when {
extendedOnboardingFeatureToggles.testPrivacyProOnboardingCopyNov24().isEnabled(Cohorts.PROTECTION) -> "_${Cohorts.PROTECTION.cohortName}"
extendedOnboardingFeatureToggles.testPrivacyProOnboardingCopyNov24().isEnabled(Cohorts.PIR) -> "_${Cohorts.PIR.cohortName}"
extendedOnboardingFeatureToggles.testPrivacyProOnboardingCopyNov24().isEnabled(Cohorts.VPN) -> "_${Cohorts.VPN.cohortName}"
extendedOnboardingFeatureToggles.testPrivacyProOnboardingCopyNov24().isEnabled(Cohorts.CONTROL) -> "_${Cohorts.CONTROL.cohortName}"
else -> ""
}
}

companion object {
private const val MAX_TABS_OPEN_FIRE_EDUCATION = 2
}
Expand Down

0 comments on commit 607fbe0

Please sign in to comment.