From 4d78d097cc71babcfe81a7ed10d19f87f3e6be4e Mon Sep 17 00:00:00 2001 From: Christopher Brind Date: Fri, 13 Dec 2024 12:21:47 +0000 Subject: [PATCH] fire tab switcher / manager sources pixel (#3722) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task/Issue URL: https://app.asana.com/0/392891325557410/1208882840835128/f Tech Design URL: CC: **Description**: Fires a pixel depending on what is going on when the user opens the tab switcher. Also renames a couple of pixels for clarity. **Steps to test this PR**: 1. Open the tab switcher from anywhere should fire `m_tab_manager_opened_daily` but only the first time during in a day 2. Open the tab switcher from anywhere should fire `m_tab_manager_opened` every time 1. Open the tab switcher on the new tab page should fire `m_tab_manager_open_from_newtabpage` every time 2. Open the tab switcher while on the serp should fire `m_tab_manager_open_from_serp` every time 3. Open the tab switcher while on a website should fire `m_tab_manager_open_from_website` every time --- Core/PixelEvent.swift | 16 ++++++++++++---- DuckDuckGo/MainViewController.swift | 11 +++++++++-- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/Core/PixelEvent.swift b/Core/PixelEvent.swift index caf2b9f04e..8e6f1c3beb 100644 --- a/Core/PixelEvent.swift +++ b/Core/PixelEvent.swift @@ -60,7 +60,11 @@ extension Pixel { case tabSwitcherClickCloseTab case tabSwitcherSwipeCloseTab case tabSwitchLongPressNewTab - case tabSwitcherOpenDaily + case tabSwitcherOpenedDaily + + case tabSwitcherOpenedFromSerp + case tabSwitcherOpenedFromWebsite + case tabSwitcherOpenedFromNewTabPage case settingsDoNotSellShown case settingsDoNotSellOn @@ -118,7 +122,7 @@ extension Pixel { case tabBarForwardPressed case bookmarksButtonPressed case tabBarBookmarksLongPressed - case tabBarTabSwitcherPressed + case tabBarTabSwitcherOpened case homeScreenShown case homeScreenEditFavorite @@ -984,7 +988,11 @@ extension Pixel.Event { case .tabSwitcherClickCloseTab: return "m_tab_manager_close_tab_click" case .tabSwitcherSwipeCloseTab: return "m_tab_manager_close_tab_swipe" case .tabSwitchLongPressNewTab: return "m_tab_manager_long_press_new_tab" - case .tabSwitcherOpenDaily: return "m_tab_manager_clicked_daily" + case .tabSwitcherOpenedDaily: return "m_tab_manager_opened_daily" + + case .tabSwitcherOpenedFromSerp: return "m_tab_manager_open_from_serp" + case .tabSwitcherOpenedFromWebsite: return "m_tab_manager_open_from_website" + case .tabSwitcherOpenedFromNewTabPage: return "m_tab_manager_open_from_newtabpage" case .settingsDoNotSellShown: return "ms_dns" case .settingsDoNotSellOn: return "ms_dns_on" @@ -1064,7 +1072,7 @@ extension Pixel.Event { case .tabBarForwardPressed: return "mt_fw" case .bookmarksButtonPressed: return "mt_bm" case .tabBarBookmarksLongPressed: return "mt_bl" - case .tabBarTabSwitcherPressed: return "mt_tb" + case .tabBarTabSwitcherOpened: return "m_tab_manager_opened" case .bookmarkLaunchList: return "m_bookmark_launch_list" case .bookmarkLaunchScored: return "m_bookmark_launch_scored" diff --git a/DuckDuckGo/MainViewController.swift b/DuckDuckGo/MainViewController.swift index c129c44057..42a9bc7ea8 100644 --- a/DuckDuckGo/MainViewController.swift +++ b/DuckDuckGo/MainViewController.swift @@ -2611,8 +2611,15 @@ extension MainViewController: TabSwitcherButtonDelegate { } func showTabSwitcher(_ button: TabSwitcherButton) { - Pixel.fire(pixel: .tabBarTabSwitcherPressed) - DailyPixel.fireDaily(.tabSwitcherOpenDaily, withAdditionalParameters: TabSwitcherOpenDailyPixel().parameters(with: tabManager.model.tabs)) + Pixel.fire(pixel: .tabBarTabSwitcherOpened) + DailyPixel.fireDaily(.tabSwitcherOpenedDaily, withAdditionalParameters: TabSwitcherOpenDailyPixel().parameters(with: tabManager.model.tabs)) + if currentTab?.url?.isDuckDuckGoSearch == true { + Pixel.fire(pixel: .tabSwitcherOpenedFromSerp) + } else if currentTab?.url != nil { + Pixel.fire(pixel: .tabSwitcherOpenedFromWebsite) + } else { + Pixel.fire(pixel: .tabSwitcherOpenedFromNewTabPage) + } performCancel() showTabSwitcher()