Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

For #15366: Add recently closed tabs metrics. #16739

Merged
merged 3 commits into from
Dec 15, 2020
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
15 changes: 14 additions & 1 deletion app/metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,20 @@ events:
notification_emails:
- fenix-core@mozilla.com
expires: "2021-04-01"

recently_closed_tabs_opened:
type: event
description: |
An event that indicates that the user
has accessed recently closed tabs list.
bugs:
- https://github.com/mozilla-mobile/fenix/issues/15366
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/16739
data_sensitivity:
- interaction
notification_emails:
- fenix-core@mozilla.com
expires: "2021-05-10"
onboarding:
fxa_auto_signin:
type: event
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ sealed class Event {

object TabSettingsOpened : Event()

object RecentlyClosedTabsOpened : Event()

// Interaction events with extras

data class TopSiteSwipeCarousel(val page: Int) : Event() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,10 @@ private val Event.wrapper: EventWrapper<*>?
{ ProgressiveWebApp.backgroundKeys.valueOf(it) }
)

is Event.RecentlyClosedTabsOpened -> EventWrapper<NoExtraKeys>(
{ Events.recentlyClosedTabsOpened.record(it) }
)

Event.MasterPasswordMigrationDisplayed -> EventWrapper<NoExtraKeys>(
{ MasterPassword.displayed.record(it) }
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import mozilla.components.concept.engine.prompt.ShareData
import org.mozilla.fenix.R
import org.mozilla.fenix.browser.browsingmode.BrowsingMode
import org.mozilla.fenix.components.FenixSnackbar
import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.components.metrics.MetricController

@Suppress("TooManyFunctions")
interface HistoryController {
Expand Down Expand Up @@ -43,7 +45,8 @@ class DefaultHistoryController(
private val displayDeleteAll: () -> Unit,
private val invalidateOptionsMenu: () -> Unit,
private val deleteHistoryItems: (Set<HistoryItem>) -> Unit,
private val syncHistory: suspend () -> Unit
private val syncHistory: suspend () -> Unit,
private val metrics: MetricController
) : HistoryController {
override fun handleOpen(item: HistoryItem, mode: BrowsingMode?) {
openToBrowser(item, mode)
Expand Down Expand Up @@ -111,5 +114,6 @@ class DefaultHistoryController(
HistoryFragmentDirections.actionGlobalRecentlyClosed(),
NavOptions.Builder().setPopUpTo(R.id.recentlyClosedFragment, true).build()
)
metrics.track(Event.RecentlyClosedTabsOpened)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,9 @@ class HistoryFragment : LibraryPageFragment<HistoryItem>(), UserInteractionHandl
::displayDeleteAllDialog,
::invalidateOptionsMenu,
::deleteHistoryItems,
::syncHistory
)
::syncHistory,
requireComponents.analytics.metrics
)
historyInteractor = HistoryInteractor(
historyController
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ class DefaultTabTrayController(
override fun handleRecentlyClosedClicked() {
val directions = TabTrayDialogFragmentDirections.actionGlobalRecentlyClosed()
navController.navigate(directions)
metrics.track(Event.RecentlyClosedTabsOpened)
}

override fun handleGoToTabsSettingClicked() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import org.junit.Test
import org.junit.runner.RunWith
import org.mozilla.fenix.browser.browsingmode.BrowsingMode
import org.mozilla.fenix.components.FenixSnackbar
import org.mozilla.fenix.components.metrics.MetricController
import org.mozilla.fenix.ext.directionsEq
import org.mozilla.fenix.helpers.FenixRobolectricTestRunner

Expand All @@ -45,6 +46,7 @@ class HistoryControllerTest {
private val invalidateOptionsMenu: () -> Unit = mockk(relaxed = true)
private val deleteHistoryItems: (Set<HistoryItem>) -> Unit = mockk(relaxed = true)
private val syncHistory: suspend () -> Unit = mockk(relaxed = true)
private val metrics: MetricController = mockk(relaxed = true)
private val controller = DefaultHistoryController(
store,
navController,
Expand All @@ -56,7 +58,8 @@ class HistoryControllerTest {
displayDeleteAll,
invalidateOptionsMenu,
deleteHistoryItems,
syncHistory
syncHistory,
metrics
)

@Before
Expand Down
1 change: 1 addition & 0 deletions docs/metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ The following metrics are added to the ping:
| events.opened_link |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user opened a link with Fenix |[1](https://github.com/mozilla-mobile/fenix/pull/5975), [2](https://github.com/mozilla-mobile/fenix/pull/13958#issuecomment-676857877)|<ul><li>mode: The mode the link was opened in. Either 'PRIVATE' or 'NORMAL'. N.B.: this probe may be incorrectly implemented: see https://github.com/mozilla-mobile/fenix/issues/14133 </li></ul>|2021-04-01 |2 |
| events.performed_search |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user performed a search |[1](https://github.com/mozilla-mobile/fenix/pull/1067#issuecomment-474598673), [2](https://github.com/mozilla-mobile/fenix/pull/1677), [3](https://github.com/mozilla-mobile/fenix/pull/13958#issuecomment-676857877)|<ul><li>source: A string that tells us how the user performed the search. Possible values are: * default.action * default.suggestion * shortcut.action * shortcut.suggestion </li></ul>|2021-04-01 |2 |
| events.preference_toggled |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user toggled a boolean preference in settings |[1](https://github.com/mozilla-mobile/fenix/pull/1896), [2](https://github.com/mozilla-mobile/fenix/pull/5704), [3](https://github.com/mozilla-mobile/fenix/pull/5886), [4](https://github.com/mozilla-mobile/fenix/pull/5975), [5](https://github.com/mozilla-mobile/fenix/pull/6352), [6](https://github.com/mozilla-mobile/fenix/pull/6601), [7](https://github.com/mozilla-mobile/fenix/pull/6746), [8](https://github.com/mozilla-mobile/fenix/pull/13958#issuecomment-676857877)|<ul><li>enabled: Whether or not the preference is *now* enabled</li><li>preference_key: The preference key for the boolean (true/false) preference the user toggled. We currently track: show_search_suggestions, remote_debugging, telemetry, tracking_protection, search_bookmarks, search_browsing_history, show_clipboard_suggestions, show_search_shortcuts, open_links_in_a_private_tab (bug in implementation https://github.com/mozilla-mobile/fenix/issues/7384), pref_key_sync_logins, pref_key_sync_bookmarks, pref_key_sync_history, pref_key_show_voice_search, and pref_key_show_search_suggestions_in_private. </li></ul>|2021-06-01 |1, 2 |
| events.recently_closed_tabs_opened |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |An event that indicates that the user has accessed recently closed tabs list. |[1](https://github.com/mozilla-mobile/fenix/pull/16739)||2021-05-10 |2 |
| events.search_bar_tapped |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user tapped the search bar |[1](https://github.com/mozilla-mobile/fenix/pull/1067#issuecomment-474598673), [2](https://github.com/mozilla-mobile/fenix/pull/13958#issuecomment-676857877)|<ul><li>source: The view the user was on when they initiated the search (For example: `Home` or `Browser`) </li></ul>|2021-04-01 |2 |
| events.tab_counter_menu_action |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A tab counter menu item was tapped |[1](https://github.com/mozilla-mobile/fenix/pull/11533), [2](https://github.com/mozilla-mobile/fenix/pull/13958#issuecomment-676857877)|<ul><li>item: A string containing the name of the item the user tapped. These items are: New tab, New private tab, Close tab </li></ul>|2021-04-01 |2 |
| events.whats_new_tapped |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user opened the "what's new" page button |[1](https://github.com/mozilla-mobile/fenix/pull/5090), [2](https://github.com/mozilla-mobile/fenix/pull/13958#issuecomment-676857877)||2021-04-01 |2 |
Expand Down