From 22a078ca24484a56a2e6ce2b77b22f9f43cc902f Mon Sep 17 00:00:00 2001 From: Cris Barreiro Date: Tue, 5 Nov 2024 12:35:10 +0100 Subject: [PATCH 1/3] Add pixels and remove ATB --- app/src/main/java/com/duckduckgo/app/cta/ui/Cta.kt | 6 ++++-- .../app/global/api/PixelParamRemovalInterceptor.kt | 5 +++++ app/src/main/java/com/duckduckgo/app/pixels/AppPixelName.kt | 3 +++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/duckduckgo/app/cta/ui/Cta.kt b/app/src/main/java/com/duckduckgo/app/cta/ui/Cta.kt index 50439215a504..627340aadaf8 100644 --- a/app/src/main/java/com/duckduckgo/app/cta/ui/Cta.kt +++ b/app/src/main/java/com/duckduckgo/app/cta/ui/Cta.kt @@ -38,6 +38,8 @@ import com.duckduckgo.app.global.install.AppInstallStore import com.duckduckgo.app.global.install.daysInstalled import com.duckduckgo.app.onboarding.store.OnboardingStore import com.duckduckgo.app.pixels.AppPixelName +import com.duckduckgo.app.pixels.AppPixelName.SITE_NOT_WORKING_SHOWN +import com.duckduckgo.app.pixels.AppPixelName.SITE_NOT_WORKING_WEBSITE_BROKEN import com.duckduckgo.app.settings.db.SettingsDataStore import com.duckduckgo.app.statistics.pixels.Pixel import com.duckduckgo.app.statistics.pixels.Pixel.PixelValues.DAX_FIRE_DIALOG_CTA @@ -1098,8 +1100,8 @@ sealed class HomePanelCta( class BrokenSitePromptDialogCta() : Cta { override val ctaId: CtaId = CtaId.BROKEN_SITE_PROMPT - override val shownPixel: Pixel.PixelName? = null - override val okPixel: Pixel.PixelName? = null + override val shownPixel: Pixel.PixelName = SITE_NOT_WORKING_SHOWN + override val okPixel: Pixel.PixelName = SITE_NOT_WORKING_WEBSITE_BROKEN override val cancelPixel: Pixel.PixelName? = null override fun pixelCancelParameters(): Map = mapOf() diff --git a/app/src/main/java/com/duckduckgo/app/global/api/PixelParamRemovalInterceptor.kt b/app/src/main/java/com/duckduckgo/app/global/api/PixelParamRemovalInterceptor.kt index 8e31b33560c4..3d902743d84a 100644 --- a/app/src/main/java/com/duckduckgo/app/global/api/PixelParamRemovalInterceptor.kt +++ b/app/src/main/java/com/duckduckgo/app/global/api/PixelParamRemovalInterceptor.kt @@ -19,6 +19,8 @@ package com.duckduckgo.app.global.api import com.duckduckgo.app.browser.WebViewPixelName import com.duckduckgo.app.browser.httperrors.HttpErrorPixelName import com.duckduckgo.app.pixels.AppPixelName +import com.duckduckgo.app.pixels.AppPixelName.SITE_NOT_WORKING_SHOWN +import com.duckduckgo.app.pixels.AppPixelName.SITE_NOT_WORKING_WEBSITE_BROKEN import com.duckduckgo.app.statistics.pixels.Pixel import com.duckduckgo.common.utils.AppUrl import com.duckduckgo.common.utils.plugins.PluginPoint @@ -87,6 +89,9 @@ object PixelInterceptorPixelsRequiringDataCleaning : PixelParamRemovalPlugin { HttpErrorPixelName.WEBVIEW_RECEIVED_HTTP_ERROR_4XX_DAILY.pixelName to PixelParameter.removeAtb(), HttpErrorPixelName.WEBVIEW_RECEIVED_HTTP_ERROR_5XX_DAILY.pixelName to PixelParameter.removeAtb(), AppPixelName.FEATURES_ENABLED_AT_SEARCH_TIME.pixelName to PixelParameter.removeAll(), + SITE_NOT_WORKING_SHOWN.pixelName to PixelParameter.removeAtb(), + SITE_NOT_WORKING_WEBSITE_BROKEN.pixelName to PixelParameter.removeAtb(), + ) } } diff --git a/app/src/main/java/com/duckduckgo/app/pixels/AppPixelName.kt b/app/src/main/java/com/duckduckgo/app/pixels/AppPixelName.kt index 4839651d9701..3910559e65bb 100644 --- a/app/src/main/java/com/duckduckgo/app/pixels/AppPixelName.kt +++ b/app/src/main/java/com/duckduckgo/app/pixels/AppPixelName.kt @@ -375,6 +375,9 @@ enum class AppPixelName(override val pixelName: String) : Pixel.PixelName { RELOAD_TWICE_WITHIN_12_SECONDS("m_reload_twice_within_12_seconds"), RELOAD_THREE_TIMES_WITHIN_20_SECONDS("m_reload_three_times_within_20_seconds"), + SITE_NOT_WORKING_WEBSITE_BROKEN("site_not_working_website_is_broken"), + SITE_NOT_WORKING_SHOWN("m.site_not_working_shown"), + URI_LOADED("m_uri_loaded"), ERROR_PAGE_SHOWN("m_errorpageshown"), From 371aaffe8286bef6926739c93b4a7dd81c997d53 Mon Sep 17 00:00:00 2001 From: Cris Barreiro Date: Tue, 5 Nov 2024 12:50:58 +0100 Subject: [PATCH 2/3] Test pixels fired --- .../com/duckduckgo/app/cta/ui/CtaViewModelTest.kt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/src/androidTest/java/com/duckduckgo/app/cta/ui/CtaViewModelTest.kt b/app/src/androidTest/java/com/duckduckgo/app/cta/ui/CtaViewModelTest.kt index 6e84f50ad5aa..fd6448d6204f 100644 --- a/app/src/androidTest/java/com/duckduckgo/app/cta/ui/CtaViewModelTest.kt +++ b/app/src/androidTest/java/com/duckduckgo/app/cta/ui/CtaViewModelTest.kt @@ -185,6 +185,18 @@ class CtaViewModelTest { verify(mockPixel, never()).fire(eq(SURVEY_CTA_SHOWN), any(), any(), eq(Count)) } + @Test + fun whenBrokenSitePromptDialogCtaIsShownThenPixelIsFired() = runTest { + testee.onCtaShown(BrokenSitePromptDialogCta()) + verify(mockPixel).fire(eq(SITE_NOT_WORKING_SHOWN), any(), any(), eq(Count)) + } + + @Test + fun whenUserClicksReportBrokenSiteThenPixelIsFired() = runTest { + testee.onUserClickCtaOkButton(BrokenSitePromptDialogCta()) + verify(mockPixel).fire(eq(SITE_NOT_WORKING_WEBSITE_BROKEN), any(), any(), eq(Count)) + } + @Test fun whenCtaShownAndCtaIsDaxAndCanSendPixelThenPixelIsFired() = runTest { whenever(mockOnboardingStore.onboardingDialogJourney).thenReturn("s:0") From c6da822ecc550e8ee0986e2239a90899ecaebf42 Mon Sep 17 00:00:00 2001 From: Cris Barreiro Date: Thu, 7 Nov 2024 18:23:21 +0100 Subject: [PATCH 3/3] Remove m prefix from pixel --- app/src/main/java/com/duckduckgo/app/pixels/AppPixelName.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/duckduckgo/app/pixels/AppPixelName.kt b/app/src/main/java/com/duckduckgo/app/pixels/AppPixelName.kt index 3910559e65bb..49fa0da6ccbb 100644 --- a/app/src/main/java/com/duckduckgo/app/pixels/AppPixelName.kt +++ b/app/src/main/java/com/duckduckgo/app/pixels/AppPixelName.kt @@ -376,7 +376,7 @@ enum class AppPixelName(override val pixelName: String) : Pixel.PixelName { RELOAD_THREE_TIMES_WITHIN_20_SECONDS("m_reload_three_times_within_20_seconds"), SITE_NOT_WORKING_WEBSITE_BROKEN("site_not_working_website_is_broken"), - SITE_NOT_WORKING_SHOWN("m.site_not_working_shown"), + SITE_NOT_WORKING_SHOWN("site_not_working_shown"), URI_LOADED("m_uri_loaded"),