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

Add pixels and remove ATB #5237

Merged
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 @@ -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")
Expand Down
6 changes: 4 additions & 2 deletions app/src/main/java/com/duckduckgo/app/cta/ui/Cta.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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<String, String> = mapOf()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(),

)
}
}
3 changes: 3 additions & 0 deletions app/src/main/java/com/duckduckgo/app/pixels/AppPixelName.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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("site_not_working_shown"),

URI_LOADED("m_uri_loaded"),

ERROR_PAGE_SHOWN("m_errorpageshown"),
Expand Down
Loading