2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-03 23:15:31 +00:00

For #11442 - Telemetry for tab counter menu.

This commit is contained in:
person808 2020-06-12 12:28:38 -07:00 committed by Jeff Boek
parent af64d93832
commit 9e3e95e351
5 changed files with 38 additions and 0 deletions

View File

@ -186,6 +186,24 @@ events:
notification_emails:
- fenix-core@mozilla.com
expires: "2020-09-01"
tab_counter_menu_action:
type: event
description:
A tab counter menu item was tapped
extra_keys:
item:
description: |
A string containing the name of the item the user tapped. These items
are:
New tab, New private tab, Close tab
bugs:
- https://github.com/mozilla-mobile/fenix/issues/11442
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/11533
notification_emails:
- fenix-core@mozilla.com
expires: "2020-09-01"
search_shortcuts:
selected:

View File

@ -548,6 +548,10 @@ private val Event.wrapper: EventWrapper<*>?
is Event.SearchWidgetCFRAddWidgetPressed -> EventWrapper<NoExtraKeys>(
{ SearchWidgetCfr.addWidgetPressed.record(it) }
)
is Event.TabCounterMenuItemTapped -> EventWrapper(
{ Events.tabCounterMenuAction.record(it) },
{ Events.tabCounterMenuActionKeys.valueOf(it) }
)
// Don't record other events in Glean:
is Event.AddBookmark -> null

View File

@ -431,6 +431,15 @@ sealed class Event {
get() = mapOf(Events.browserMenuActionKeys.item to item.toString().toLowerCase(Locale.ROOT))
}
data class TabCounterMenuItemTapped(val item: Item) : Event() {
enum class Item {
NEW_TAB, NEW_PRIVATE_TAB, CLOSE_TAB
}
override val extras: Map<Events.tabCounterMenuActionKeys, String>?
get() = mapOf(Events.tabCounterMenuActionKeys.item to item.toString().toLowerCase(Locale.ROOT))
}
sealed class Search
internal open val extras: Map<*, String>?

View File

@ -16,6 +16,8 @@ import mozilla.components.browser.session.Session
import mozilla.components.browser.session.SessionManager
import mozilla.components.concept.toolbar.Toolbar
import org.mozilla.fenix.R
import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.sessionsOfType
import org.mozilla.fenix.theme.ThemeManager
import java.lang.ref.WeakReference
@ -77,6 +79,7 @@ class TabCounterToolbarButton(
private fun getTabContextMenu(context: Context): BrowserMenu {
val primaryTextColor = ThemeManager.resolveAttribute(R.attr.primaryText, context)
val metrics = context.components.analytics.metrics
val menuItems = listOf(
BrowserMenuImageText(
label = context.getString(R.string.close_tab),
@ -84,6 +87,7 @@ class TabCounterToolbarButton(
iconTintColorResource = primaryTextColor,
textColorResource = primaryTextColor
) {
metrics.track(Event.TabCounterMenuItemTapped(Event.TabCounterMenuItemTapped.Item.CLOSE_TAB))
onItemTapped(TabCounterMenuItem.CloseTab)
},
BrowserMenuDivider(),
@ -93,6 +97,7 @@ class TabCounterToolbarButton(
iconTintColorResource = primaryTextColor,
textColorResource = primaryTextColor
) {
metrics.track(Event.TabCounterMenuItemTapped(Event.TabCounterMenuItemTapped.Item.NEW_TAB))
onItemTapped(TabCounterMenuItem.NewTab(false))
},
BrowserMenuImageText(
@ -101,6 +106,7 @@ class TabCounterToolbarButton(
iconTintColorResource = primaryTextColor,
textColorResource = primaryTextColor
) {
metrics.track(Event.TabCounterMenuItemTapped(Event.TabCounterMenuItemTapped.Item.NEW_PRIVATE_TAB))
onItemTapped(TabCounterMenuItem.NewTab(true))
}
)

View File

@ -102,6 +102,7 @@ The following metrics are added to the ping:
| 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)|<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>|2020-09-01 |
| 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)|<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>|2020-09-01 |
| 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)|<ul><li>source: The view the user was on when they initiated the search (For example: `Home` or `Browser`) </li></ul>|2020-09-01 |
| 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)|<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>|2020-09-01 |
| 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)||2020-09-01 |
| find_in_page.closed |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user closed the find in page UI |[1](https://github.com/mozilla-mobile/fenix/pull/1344#issuecomment-479285010)||2020-09-01 |
| find_in_page.opened |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user opened the find in page UI |[1](https://github.com/mozilla-mobile/fenix/pull/1344#issuecomment-479285010)||2020-09-01 |