Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove temporary pixel when not showing trackers network dialog #5471

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,8 @@ import com.duckduckgo.app.privacy.model.TestEntity
import com.duckduckgo.app.settings.db.SettingsDataStore
import com.duckduckgo.app.statistics.pixels.Pixel
import com.duckduckgo.app.statistics.pixels.Pixel.PixelType.Count
import com.duckduckgo.app.statistics.pixels.Pixel.PixelType.Unique
import com.duckduckgo.app.tabs.model.TabEntity
import com.duckduckgo.app.tabs.model.TabRepository
import com.duckduckgo.app.trackerdetection.blocklist.BlockList.Cohorts.CONTROL
import com.duckduckgo.app.trackerdetection.model.Entity
import com.duckduckgo.app.trackerdetection.model.TrackerStatus
import com.duckduckgo.app.trackerdetection.model.TrackerType
Expand Down Expand Up @@ -794,7 +792,6 @@ class CtaViewModelTest {
val site = site(url = privacyProUrl)

val value = testee.refreshCta(coroutineRule.testDispatcher, isBrowserShowing = true, site = site)
verify(mockPixel, never()).fire(eq(ONBOARDING_SKIP_MAJOR_NETWORK_UNIQUE), any(), any(), eq(Unique()))
assertNull(value)
}

Expand All @@ -813,36 +810,6 @@ class CtaViewModelTest {
assertNull(value)
}

@Test
fun givenDuckPlayerSiteWhenRefreshCtaWhileBrowsingThenFireSkipMajorNetworkPixel() = runTest {
givenDaxOnboardingActive()
val site = site(url = "duck://player/12345", entity = TestEntity("Google", "Google", 9.0))

whenever(mockDuckPlayer.isDuckPlayerUri(any())).thenReturn(true)
whenever(mockDuckPlayer.getDuckPlayerState()).thenReturn(ENABLED)
whenever(mockDuckPlayer.getUserPreferences()).thenReturn(UserPreferences(false, AlwaysAsk))
whenever(mockDuckPlayer.isYouTubeUrl(any())).thenReturn(false)
whenever(mockDuckPlayer.isSimulatedYoutubeNoCookie(any())).thenReturn(false)

testee.refreshCta(coroutineRule.testDispatcher, isBrowserShowing = true, site = site)
verify(mockPixel).fire(eq(ONBOARDING_SKIP_MAJOR_NETWORK_UNIQUE), any(), any(), eq(Unique()))
}

@Test
fun givenDuckPlayerSiteWhenRefreshCtaWhileBrowsingAndTrackersDialogAlreadyShownThenDontSentSkipMajorNetworkPixel() = runTest {
givenDaxOnboardingActive()
val site = site(url = "duck://player/12345", entity = TestEntity("Google", "Google", 9.0))

whenever(mockDuckPlayer.isDuckPlayerUri(any())).thenReturn(true)
whenever(mockDuckPlayer.getDuckPlayerState()).thenReturn(ENABLED)
whenever(mockDuckPlayer.getUserPreferences()).thenReturn(UserPreferences(false, AlwaysAsk))
whenever(mockDuckPlayer.isYouTubeUrl(any())).thenReturn(false)
whenever(mockDuckPlayer.isSimulatedYoutubeNoCookie(any())).thenReturn(false)

testee.refreshCta(coroutineRule.testDispatcher, isBrowserShowing = true, site = site)
verify(mockPixel).fire(eq(ONBOARDING_SKIP_MAJOR_NETWORK_UNIQUE), any(), any(), eq(Unique()))
}

@Test
fun givenHighlightsExperimentWhenRefreshCtaOnHomeTabAndIntroCtaWasNotPreviouslyShownThenExperimentIntroCtaShown() = runTest {
givenDaxOnboardingActive()
Expand Down
11 changes: 0 additions & 11 deletions app/src/main/java/com/duckduckgo/app/cta/ui/CtaViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,9 @@ import com.duckduckgo.app.onboarding.ui.page.extendedonboarding.testPrivacyProOn
import com.duckduckgo.app.onboarding.ui.page.extendedonboarding.testPrivacyProOnboardingSecondaryButtonMetricPixel
import com.duckduckgo.app.onboarding.ui.page.extendedonboarding.testPrivacyProOnboardingShownMetricPixel
import com.duckduckgo.app.pixels.AppPixelName
import com.duckduckgo.app.pixels.AppPixelName.ONBOARDING_SKIP_MAJOR_NETWORK_UNIQUE
import com.duckduckgo.app.privacy.db.UserAllowListRepository
import com.duckduckgo.app.settings.db.SettingsDataStore
import com.duckduckgo.app.statistics.pixels.Pixel
import com.duckduckgo.app.statistics.pixels.Pixel.PixelType.Unique
import com.duckduckgo.app.tabs.model.TabRepository
import com.duckduckgo.app.widget.ui.WidgetCapabilities
import com.duckduckgo.brokensite.api.BrokenSitePrompt
Expand Down Expand Up @@ -486,15 +484,6 @@ class CtaViewModel @Inject constructor(
duckPlayer.isDuckPlayerUri(site.url) || duckPlayer.isSimulatedYoutubeNoCookie(uri)
)

if (isDuckPlayerUrl) { // temporary pixel
val isMayorNetwork = !daxDialogNetworkShown() && !daxDialogTrackersFoundShown() && OnboardingDaxDialogCta.mainTrackerNetworks.any {
site.entity?.displayName?.contains(it) ?: false
}
if (isMayorNetwork) {
pixel.fire(pixel = ONBOARDING_SKIP_MAJOR_NETWORK_UNIQUE, type = Unique())
}
}

return isDuckPlayerUrl
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ enum class AppPixelName(override val pixelName: String) : Pixel.PixelName {
ONBOARDING_DAX_ALL_CTA_HIDDEN("m_odc_h"),
ONBOARDING_DAX_CTA_OK_BUTTON("m_odc_ok"),
ONBOARDING_DAX_CTA_CANCEL_BUTTON("m_onboarding_dax_cta_cancel"),
ONBOARDING_SKIP_MAJOR_NETWORK_UNIQUE("m_onboarding_skip_major_network_unique"),
ONBOARDING_VISIT_SITE_CTA_SHOWN("onboarding_visit_site_cta_shown"),

BROWSER_MENU_ALLOWLIST_ADD("mb_wla"),
Expand Down
Loading