For #11273: Add tabs tray telemetry (#12036)

fennec/production
Sawyer Blatz 4 years ago committed by GitHub
parent 7287b5579f
commit 101ecfbf66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1608,6 +1608,143 @@ reader_mode:
- fenix-core@mozilla.com - fenix-core@mozilla.com
expires: "2020-09-01" expires: "2020-09-01"
tabs_tray:
opened:
type: event
description: |
A user opened the tabs tray
bugs:
- https://github.com/mozilla-mobile/fenix/issues/11273
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/12036
notification_emails:
- fenix-core@mozilla.com
expires: "2020-09-01"
closed:
type: event
description: |
A user closed the tabs tray
bugs:
- https://github.com/mozilla-mobile/fenix/issues/11273
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/12036
notification_emails:
- fenix-core@mozilla.com
expires: "2020-09-01"
opened_existing_tab:
type: event
description: |
A user opened an existing tab
bugs:
- https://github.com/mozilla-mobile/fenix/issues/11273
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/12036
notification_emails:
- fenix-core@mozilla.com
expires: "2020-09-01"
closed_existing_tab:
type: event
description: |
A user closed an existing tab
bugs:
- https://github.com/mozilla-mobile/fenix/issues/11273
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/12036
notification_emails:
- fenix-core@mozilla.com
expires: "2020-09-01"
private_mode_tapped:
type: event
description: |
A user switched to private mode
bugs:
- https://github.com/mozilla-mobile/fenix/issues/11273
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/12036
notification_emails:
- fenix-core@mozilla.com
expires: "2020-09-01"
normal_mode_tapped:
type: event
description: |
A user switched to normal mode
bugs:
- https://github.com/mozilla-mobile/fenix/issues/11273
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/12036
notification_emails:
- fenix-core@mozilla.com
expires: "2020-09-01"
new_tab_tapped:
type: event
description: |
A user opened a new tab
bugs:
- https://github.com/mozilla-mobile/fenix/issues/11273
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/12036
notification_emails:
- fenix-core@mozilla.com
expires: "2020-09-01"
new_private_tab_tapped:
type: event
description: |
A user opened a new private tab
bugs:
- https://github.com/mozilla-mobile/fenix/issues/11273
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/12036
notification_emails:
- fenix-core@mozilla.com
expires: "2020-09-01"
menu_opened:
type: event
description: |
A user opened three three dot menu in the tabs tray
bugs:
- https://github.com/mozilla-mobile/fenix/issues/11273
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/12036
notification_emails:
- fenix-core@mozilla.com
expires: "2020-09-01"
save_to_collection:
type: event
description: |
A user tapped the save to collection button in the
three dot menu within the tabs tray
bugs:
- https://github.com/mozilla-mobile/fenix/issues/11273
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/12036
notification_emails:
- fenix-core@mozilla.com
expires: "2020-09-01"
share_all_tabs:
type: event
description: |
A user tapped the share all tabs button in the
three dot menu within the tabs tray
bugs:
- https://github.com/mozilla-mobile/fenix/issues/11273
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/12036
notification_emails:
- fenix-core@mozilla.com
expires: "2020-09-01"
close_all_tabs:
type: event
description: |
A user tapped the close all tabs button in the
three dot menu within the tabs tray
bugs:
- https://github.com/mozilla-mobile/fenix/issues/11273
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/12036
notification_emails:
- fenix-core@mozilla.com
expires: "2020-09-01"
collections: collections:
renamed: renamed:
type: event type: event

@ -22,16 +22,15 @@ import org.mozilla.fenix.GleanMetrics.CustomTab
import org.mozilla.fenix.GleanMetrics.DownloadNotification import org.mozilla.fenix.GleanMetrics.DownloadNotification
import org.mozilla.fenix.GleanMetrics.ErrorPage import org.mozilla.fenix.GleanMetrics.ErrorPage
import org.mozilla.fenix.GleanMetrics.Events import org.mozilla.fenix.GleanMetrics.Events
import org.mozilla.fenix.GleanMetrics.Events.preferenceToggled
import org.mozilla.fenix.GleanMetrics.FindInPage import org.mozilla.fenix.GleanMetrics.FindInPage
import org.mozilla.fenix.GleanMetrics.History import org.mozilla.fenix.GleanMetrics.History
import org.mozilla.fenix.GleanMetrics.Logins import org.mozilla.fenix.GleanMetrics.Logins
import org.mozilla.fenix.GleanMetrics.MediaNotification import org.mozilla.fenix.GleanMetrics.MediaNotification
import org.mozilla.fenix.GleanMetrics.MediaState import org.mozilla.fenix.GleanMetrics.MediaState
import org.mozilla.fenix.GleanMetrics.Metrics import org.mozilla.fenix.GleanMetrics.Metrics
import org.mozilla.fenix.GleanMetrics.Onboarding
import org.mozilla.fenix.GleanMetrics.Pings import org.mozilla.fenix.GleanMetrics.Pings
import org.mozilla.fenix.GleanMetrics.Pocket import org.mozilla.fenix.GleanMetrics.Pocket
import org.mozilla.fenix.GleanMetrics.Onboarding
import org.mozilla.fenix.GleanMetrics.Preferences import org.mozilla.fenix.GleanMetrics.Preferences
import org.mozilla.fenix.GleanMetrics.PrivateBrowsingMode import org.mozilla.fenix.GleanMetrics.PrivateBrowsingMode
import org.mozilla.fenix.GleanMetrics.PrivateBrowsingShortcut import org.mozilla.fenix.GleanMetrics.PrivateBrowsingShortcut
@ -602,6 +601,43 @@ private val Event.wrapper: EventWrapper<*>?
{ ContextualHintTrackingProtection.outsideTap.record(it) } { ContextualHintTrackingProtection.outsideTap.record(it) }
) )
is Event.TabsTrayOpened -> EventWrapper<NoExtraKeys>(
{ org.mozilla.fenix.GleanMetrics.TabsTray.opened.record(it) }
)
is Event.TabsTrayClosed -> EventWrapper<NoExtraKeys>(
{ org.mozilla.fenix.GleanMetrics.TabsTray.closed.record(it) }
)
is Event.OpenedExistingTab -> EventWrapper<NoExtraKeys>(
{ org.mozilla.fenix.GleanMetrics.TabsTray.openedExistingTab.record(it) }
)
is Event.ClosedExistingTab -> EventWrapper<NoExtraKeys>(
{ org.mozilla.fenix.GleanMetrics.TabsTray.closedExistingTab.record(it) }
)
is Event.TabsTrayPrivateModeTapped -> EventWrapper<NoExtraKeys>(
{ org.mozilla.fenix.GleanMetrics.TabsTray.privateModeTapped.record(it) }
)
is Event.TabsTrayNormalModeTapped -> EventWrapper<NoExtraKeys>(
{ org.mozilla.fenix.GleanMetrics.TabsTray.normalModeTapped.record(it) }
)
is Event.NewTabTapped -> EventWrapper<NoExtraKeys>(
{ org.mozilla.fenix.GleanMetrics.TabsTray.newTabTapped.record(it) }
)
is Event.NewPrivateTabTapped -> EventWrapper<NoExtraKeys>(
{ org.mozilla.fenix.GleanMetrics.TabsTray.newPrivateTabTapped.record(it) }
)
is Event.TabsTrayMenuOpened -> EventWrapper<NoExtraKeys>(
{ org.mozilla.fenix.GleanMetrics.TabsTray.menuOpened.record(it) }
)
is Event.TabsTraySaveToCollectionPressed -> EventWrapper<NoExtraKeys>(
{ org.mozilla.fenix.GleanMetrics.TabsTray.saveToCollection.record(it) }
)
is Event.TabsTrayShareAllTabsPressed -> EventWrapper<NoExtraKeys>(
{ org.mozilla.fenix.GleanMetrics.TabsTray.shareAllTabs.record(it) }
)
is Event.TabsTrayCloseAllTabsPressed -> EventWrapper<NoExtraKeys>(
{ org.mozilla.fenix.GleanMetrics.TabsTray.closeAllTabs.record(it) }
)
// Don't record other events in Glean: // Don't record other events in Glean:
is Event.AddBookmark -> null is Event.AddBookmark -> null
is Event.OpenedBookmark -> null is Event.OpenedBookmark -> null

@ -185,6 +185,19 @@ sealed class Event {
object ContextualHintETPOutsideTap : Event() object ContextualHintETPOutsideTap : Event()
object ContextualHintETPInsideTap : Event() object ContextualHintETPInsideTap : Event()
object TabsTrayOpened : Event()
object TabsTrayClosed : Event()
object OpenedExistingTab : Event()
object ClosedExistingTab : Event()
object TabsTrayPrivateModeTapped : Event()
object TabsTrayNormalModeTapped : Event()
object NewTabTapped : Event()
object NewPrivateTabTapped : Event()
object TabsTrayMenuOpened : Event()
object TabsTraySaveToCollectionPressed : Event()
object TabsTrayShareAllTabsPressed : Event()
object TabsTrayCloseAllTabsPressed : Event()
// Interaction events with extras // Interaction events with extras
data class OnboardingToolbarPosition(val position: Position) : Event() { data class OnboardingToolbarPosition(val position: Position) : Event() {
enum class Position { TOP, BOTTOM } enum class Position { TOP, BOTTOM }

@ -31,6 +31,7 @@ import org.mozilla.fenix.HomeActivity
import org.mozilla.fenix.R import org.mozilla.fenix.R
import org.mozilla.fenix.components.FenixSnackbar import org.mozilla.fenix.components.FenixSnackbar
import org.mozilla.fenix.components.TabCollectionStorage import org.mozilla.fenix.components.TabCollectionStorage
import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.ext.components import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.requireComponents import org.mozilla.fenix.ext.requireComponents
import org.mozilla.fenix.utils.allowUndo import org.mozilla.fenix.utils.allowUndo
@ -54,11 +55,13 @@ class TabTrayDialogFragment : AppCompatDialogFragment() {
private val selectTabUseCase = object : TabsUseCases.SelectTabUseCase { private val selectTabUseCase = object : TabsUseCases.SelectTabUseCase {
override fun invoke(tabId: String) { override fun invoke(tabId: String) {
requireContext().components.analytics.metrics.track(Event.OpenedExistingTab)
requireComponents.useCases.tabsUseCases.selectTab(tabId) requireComponents.useCases.tabsUseCases.selectTab(tabId)
navigateToBrowser() navigateToBrowser()
} }
override fun invoke(session: Session) { override fun invoke(session: Session) {
requireContext().components.analytics.metrics.track(Event.OpenedExistingTab)
requireComponents.useCases.tabsUseCases.selectTab(session) requireComponents.useCases.tabsUseCases.selectTab(session)
navigateToBrowser() navigateToBrowser()
} }
@ -66,11 +69,13 @@ class TabTrayDialogFragment : AppCompatDialogFragment() {
private val removeTabUseCase = object : TabsUseCases.RemoveTabUseCase { private val removeTabUseCase = object : TabsUseCases.RemoveTabUseCase {
override fun invoke(sessionId: String) { override fun invoke(sessionId: String) {
requireContext().components.analytics.metrics.track(Event.ClosedExistingTab)
showUndoSnackbarForTab(sessionId) showUndoSnackbarForTab(sessionId)
requireComponents.useCases.tabsUseCases.removeTab(sessionId) requireComponents.useCases.tabsUseCases.removeTab(sessionId)
} }
override fun invoke(session: Session) { override fun invoke(session: Session) {
requireContext().components.analytics.metrics.track(Event.ClosedExistingTab)
showUndoSnackbarForTab(session.id) showUndoSnackbarForTab(session.id)
requireComponents.useCases.tabsUseCases.removeTab(session) requireComponents.useCases.tabsUseCases.removeTab(session)
} }
@ -134,6 +139,7 @@ class TabTrayDialogFragment : AppCompatDialogFragment() {
) )
tabLayout.setOnClickListener { tabLayout.setOnClickListener {
requireContext().components.analytics.metrics.track(Event.TabsTrayClosed)
dismissAllowingStateLoss() dismissAllowingStateLoss()
} }

@ -30,6 +30,7 @@ import mozilla.components.browser.state.state.BrowserState
import mozilla.components.browser.state.state.TabSessionState import mozilla.components.browser.state.state.TabSessionState
import mozilla.components.browser.tabstray.BrowserTabsTray import mozilla.components.browser.tabstray.BrowserTabsTray
import org.mozilla.fenix.R import org.mozilla.fenix.R
import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.ext.components import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.settings import org.mozilla.fenix.ext.settings
@ -64,6 +65,8 @@ class TabTrayView(
get() = container get() = container
init { init {
container.context.components.analytics.metrics.track(Event.TabsTrayOpened)
val hasAccessibilityEnabled = view.context.settings().accessibilityServicesEnabled val hasAccessibilityEnabled = view.context.settings().accessibilityServicesEnabled
toggleFabText(isPrivate) toggleFabText(isPrivate)
@ -81,6 +84,7 @@ class TabTrayView(
override fun onStateChanged(bottomSheet: View, newState: Int) { override fun onStateChanged(bottomSheet: View, newState: Int) {
if (newState == BottomSheetBehavior.STATE_HIDDEN) { if (newState == BottomSheetBehavior.STATE_HIDDEN) {
container.context.components.analytics.metrics.track(Event.TabsTrayClosed)
interactor.onTabTrayDismissed() interactor.onTabTrayDismissed()
} }
} }
@ -154,6 +158,7 @@ class TabTrayView(
} }
view.tab_tray_overflow.setOnClickListener { view.tab_tray_overflow.setOnClickListener {
container.context.components.analytics.metrics.track(Event.TabsTrayMenuOpened)
menu = tabTrayItemMenu.menuBuilder.build(container.context) menu = tabTrayItemMenu.menuBuilder.build(container.context)
menu?.show(it) menu?.show(it)
?.also { pu -> ?.also { pu ->
@ -167,6 +172,7 @@ class TabTrayView(
view.tab_tray_new_tab.apply { view.tab_tray_new_tab.apply {
isVisible = hasAccessibilityEnabled isVisible = hasAccessibilityEnabled
setOnClickListener { setOnClickListener {
sendNewTabEvent(isPrivateModeSelected)
interactor.onNewTabTapped(isPrivateModeSelected) interactor.onNewTabTapped(isPrivateModeSelected)
} }
} }
@ -174,11 +180,22 @@ class TabTrayView(
fabView.new_tab_button.apply { fabView.new_tab_button.apply {
isVisible = !hasAccessibilityEnabled isVisible = !hasAccessibilityEnabled
setOnClickListener { setOnClickListener {
sendNewTabEvent(isPrivateModeSelected)
interactor.onNewTabTapped(isPrivateModeSelected) interactor.onNewTabTapped(isPrivateModeSelected)
} }
} }
} }
private fun sendNewTabEvent(isPrivateModeSelected: Boolean) {
val eventToSend = if (isPrivateModeSelected) {
Event.NewPrivateTabTapped
} else {
Event.NewTabTapped
}
container.context.components.analytics.metrics.track(eventToSend)
}
fun expand() { fun expand() {
behavior.state = BottomSheetBehavior.STATE_EXPANDED behavior.state = BottomSheetBehavior.STATE_EXPANDED
} }
@ -195,6 +212,12 @@ class TabTrayView(
updateState(view.context.components.core.store.state) updateState(view.context.components.core.store.state)
scrollToSelectedTab() scrollToSelectedTab()
if (isPrivateModeSelected) {
container.context.components.analytics.metrics.track(Event.TabsTrayPrivateModeTapped)
} else {
container.context.components.analytics.metrics.track(Event.TabsTrayNormalModeTapped)
}
} }
override fun onTabReselected(tab: TabLayout.Tab?) { /*noop*/ } override fun onTabReselected(tab: TabLayout.Tab?) { /*noop*/ }
@ -294,6 +317,7 @@ class TabTrayItemMenu(
context.getString(R.string.tab_tray_menu_item_save), context.getString(R.string.tab_tray_menu_item_save),
textColorResource = R.color.primary_text_normal_theme textColorResource = R.color.primary_text_normal_theme
) { ) {
context.components.analytics.metrics.track(Event.TabsTraySaveToCollectionPressed)
onItemTapped.invoke(Item.SaveToCollection) onItemTapped.invoke(Item.SaveToCollection)
}.apply { visible = shouldShowSaveToCollection }, }.apply { visible = shouldShowSaveToCollection },
@ -301,6 +325,7 @@ class TabTrayItemMenu(
context.getString(R.string.tab_tray_menu_item_share), context.getString(R.string.tab_tray_menu_item_share),
textColorResource = R.color.primary_text_normal_theme textColorResource = R.color.primary_text_normal_theme
) { ) {
context.components.analytics.metrics.track(Event.TabsTrayShareAllTabsPressed)
onItemTapped.invoke(Item.ShareAllTabs) onItemTapped.invoke(Item.ShareAllTabs)
}, },
@ -308,6 +333,7 @@ class TabTrayItemMenu(
context.getString(R.string.tab_tray_menu_item_close), context.getString(R.string.tab_tray_menu_item_close),
textColorResource = R.color.primary_text_normal_theme textColorResource = R.color.primary_text_normal_theme
) { ) {
context.components.analytics.metrics.track(Event.TabsTrayCloseAllTabsPressed)
onItemTapped.invoke(Item.CloseAllTabs) onItemTapped.invoke(Item.CloseAllTabs)
} }
) )

@ -183,6 +183,18 @@ The following metrics are added to the ping:
| sync_auth.use_email_problem |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user chose to use their email to sign in after an account problem |[1](https://github.com/mozilla-mobile/fenix/pull/9835#pullrequestreview-398641844)||2020-09-01 | | sync_auth.use_email_problem |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user chose to use their email to sign in after an account problem |[1](https://github.com/mozilla-mobile/fenix/pull/9835#pullrequestreview-398641844)||2020-09-01 |
| tab.media_pause |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user pressed the pause icon on a tab from the home screen |[1](https://github.com/mozilla-mobile/fenix/pull/5266)||2020-09-01 | | tab.media_pause |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user pressed the pause icon on a tab from the home screen |[1](https://github.com/mozilla-mobile/fenix/pull/5266)||2020-09-01 |
| tab.media_play |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user pressed the play icon on a tab from the home screen |[1](https://github.com/mozilla-mobile/fenix/pull/5266)||2020-09-01 | | tab.media_play |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user pressed the play icon on a tab from the home screen |[1](https://github.com/mozilla-mobile/fenix/pull/5266)||2020-09-01 |
| tabs_tray.close_all_tabs |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user tapped the close all tabs button in the three dot menu within the tabs tray |[1](https://github.com/mozilla-mobile/fenix/pull/12036)||2020-09-01 |
| tabs_tray.closed |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user closed the tabs tray |[1](https://github.com/mozilla-mobile/fenix/pull/12036)||2020-09-01 |
| tabs_tray.closed_existing_tab |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user closed an existing tab |[1](https://github.com/mozilla-mobile/fenix/pull/12036)||2020-09-01 |
| tabs_tray.menu_opened |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user opened three three dot menu in the tabs tray |[1](https://github.com/mozilla-mobile/fenix/pull/12036)||2020-09-01 |
| tabs_tray.new_private_tab_tapped |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user opened a new private tab |[1](https://github.com/mozilla-mobile/fenix/pull/12036)||2020-09-01 |
| tabs_tray.new_tab_tapped |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user opened a new tab |[1](https://github.com/mozilla-mobile/fenix/pull/12036)||2020-09-01 |
| tabs_tray.normal_mode_tapped |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user switched to normal mode |[1](https://github.com/mozilla-mobile/fenix/pull/12036)||2020-09-01 |
| tabs_tray.opened |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user opened the tabs tray |[1](https://github.com/mozilla-mobile/fenix/pull/12036)||2020-09-01 |
| tabs_tray.opened_existing_tab |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user opened an existing tab |[1](https://github.com/mozilla-mobile/fenix/pull/12036)||2020-09-01 |
| tabs_tray.private_mode_tapped |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user switched to private mode |[1](https://github.com/mozilla-mobile/fenix/pull/12036)||2020-09-01 |
| tabs_tray.save_to_collection |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user tapped the save to collection button in the three dot menu within the tabs tray |[1](https://github.com/mozilla-mobile/fenix/pull/12036)||2020-09-01 |
| tabs_tray.share_all_tabs |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user tapped the share all tabs button in the three dot menu within the tabs tray |[1](https://github.com/mozilla-mobile/fenix/pull/12036)||2020-09-01 |
| tip.closed |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |The tip was closed |[1](https://github.com/mozilla-mobile/fenix/pull/9836)|<ul><li>identifier: The identifier of the tip closed</li></ul>|2020-09-01 | | tip.closed |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |The tip was closed |[1](https://github.com/mozilla-mobile/fenix/pull/9836)|<ul><li>identifier: The identifier of the tip closed</li></ul>|2020-09-01 |
| tip.displayed |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |The tip was displayed |[1](https://github.com/mozilla-mobile/fenix/pull/9836)|<ul><li>identifier: The identifier of the tip displayed</li></ul>|2020-09-01 | | tip.displayed |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |The tip was displayed |[1](https://github.com/mozilla-mobile/fenix/pull/9836)|<ul><li>identifier: The identifier of the tip displayed</li></ul>|2020-09-01 |
| tip.pressed |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |The tip's button was pressed |[1](https://github.com/mozilla-mobile/fenix/pull/9836)|<ul><li>identifier: The identifier of the tip the action was taken on</li></ul>|2020-09-01 | | tip.pressed |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |The tip's button was pressed |[1](https://github.com/mozilla-mobile/fenix/pull/9836)|<ul><li>identifier: The identifier of the tip the action was taken on</li></ul>|2020-09-01 |

Loading…
Cancel
Save