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

duckplayer: revert landscape impression pixel #5494

Merged
merged 1 commit into from
Jan 20, 2025
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 @@ -152,7 +152,6 @@ import com.duckduckgo.app.onboarding.ui.page.extendedonboarding.ExtendedOnboardi
import com.duckduckgo.app.onboarding.ui.page.extendedonboarding.HighlightsOnboardingExperimentManager
import com.duckduckgo.app.pixels.AppPixelName
import com.duckduckgo.app.pixels.AppPixelName.AUTOCOMPLETE_BANNER_SHOWN
import com.duckduckgo.app.pixels.AppPixelName.DUCK_PLAYER_LANDSCAPE_LAYOUT_IMPRESSIONS
import com.duckduckgo.app.pixels.AppPixelName.DUCK_PLAYER_SETTING_ALWAYS_DUCK_PLAYER
import com.duckduckgo.app.pixels.AppPixelName.DUCK_PLAYER_SETTING_ALWAYS_OVERLAY_YOUTUBE
import com.duckduckgo.app.pixels.AppPixelName.DUCK_PLAYER_SETTING_NEVER_OVERLAY_YOUTUBE
Expand Down Expand Up @@ -4680,21 +4679,6 @@ class BrowserTabViewModelTest {
assertCommandNotIssued<Navigate>()
}

@Test
fun whenProcessJsCallbackMessageTelemetryEventThenFirePixel() = runTest {
whenever(mockEnabledToggle.isEnabled()).thenReturn(true)
whenever(mockDuckPlayer.getUserPreferences()).thenReturn(UserPreferences(overlayInteracted = true, privatePlayerMode = AlwaysAsk))
testee.processJsCallbackMessage(
DUCK_PLAYER_PAGE_FEATURE_NAME,
"telemetryEvent",
"id",
JSONObject("""{"attributes": {"name": "impression", "value": "landscape-layout"}}"""),
false,
{ "someUrl" },
)
verify(mockPixel).fire(DUCK_PLAYER_LANDSCAPE_LAYOUT_IMPRESSIONS)
}

@Test
fun whenJsCallbackMessageInitialSetupFromOverlayThenSendResponseToJs() = runTest {
whenever(mockEnabledToggle.isEnabled()).thenReturn(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import com.duckduckgo.app.browser.commands.Command.SendResponseToDuckPlayer
import com.duckduckgo.app.browser.commands.Command.SendResponseToJs
import com.duckduckgo.app.browser.commands.Command.SendSubscriptions
import com.duckduckgo.app.browser.commands.NavigationCommand.Navigate
import com.duckduckgo.app.pixels.AppPixelName.DUCK_PLAYER_LANDSCAPE_LAYOUT_IMPRESSIONS
import com.duckduckgo.app.pixels.AppPixelName.DUCK_PLAYER_SETTING_ALWAYS_DUCK_PLAYER
import com.duckduckgo.app.pixels.AppPixelName.DUCK_PLAYER_SETTING_ALWAYS_OVERLAY_YOUTUBE
import com.duckduckgo.app.pixels.AppPixelName.DUCK_PLAYER_SETTING_ALWAYS_SERP
Expand Down Expand Up @@ -238,34 +237,6 @@ class DuckPlayerJSHelper @Inject constructor(
"reportPageException", "reportInitException" -> {
Timber.tag(method).d(data.toString())
}
"telemetryEvent" -> {
val attributes = data?.getJSONObject("attributes")

if (attributes?.getString("name") == "impression" && attributes.getString("value") == "landscape-layout") {
pixel.fire(DUCK_PLAYER_LANDSCAPE_LAYOUT_IMPRESSIONS)
}

/* TODO (cbarreiro) Abstract this to provide better support for telemetry events
* https://app.asana.com/0/1202552961248957/1208690124356904/f */
/**
* incoming data looks like this, where `name` is used to discriminate,
* and 'value' is linked to it (but is optional)
*
* {
* "attributes": {
* "name": "impression",
* "value": "landscape-layout"
* }
* }
*
* Another event might look like this in the future: (note: no 'value' field)
* {
* "attributes": {
* "name": "page-view"
* }
* }
*/
}
"openSettings" -> {
return OpenDuckPlayerSettings
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,6 @@ enum class AppPixelName(override val pixelName: String) : Pixel.PixelName {
DUCK_PLAYER_SETTING_NEVER_SERP("duckplayer_setting_never_overlay_serp"),
DUCK_PLAYER_SETTING_NEVER_OVERLAY_YOUTUBE("duckplayer_setting_never_overlay_youtube"),
DUCK_PLAYER_SETTING_ALWAYS_DUCK_PLAYER("duckplayer_setting_always_duck-player"),
DUCK_PLAYER_LANDSCAPE_LAYOUT_IMPRESSIONS("duckplayer_landscape_layout_impressions"),

ADD_BOOKMARK_CONFIRM_EDITED("m_add_bookmark_confirm_edit"),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ class DuckPlayerScriptsJsMessaging @Inject constructor(
"setUserValues",
"reportPageException",
"reportInitException",
"telemetryEvent",
)
}
}
Loading