diff --git a/app/metrics.yaml b/app/metrics.yaml index ab579c67c548..f255c8740a4f 100644 --- a/app/metrics.yaml +++ b/app/metrics.yaml @@ -256,6 +256,19 @@ events: notification_emails: - fenix-core@mozilla.com expires: "2021-10-01" + toolbar_menu_visible: + type: event + description: | + The browser menu was displayed from toolbar menu + bugs: + - https://github.com/mozilla-mobile/fenix/issues/18855 + data_reviews: + - https://github.com/mozilla-mobile/fenix/pull/18895 + data_sensitivity: + - interaction + notification_emails: + - fenix-core@mozilla.com + expires: "2021-10-01" total_uri_count: type: counter description: | diff --git a/app/src/main/java/org/mozilla/fenix/components/metrics/Event.kt b/app/src/main/java/org/mozilla/fenix/components/metrics/Event.kt index 890203e19e3f..7a2f6fe54be0 100644 --- a/app/src/main/java/org/mozilla/fenix/components/metrics/Event.kt +++ b/app/src/main/java/org/mozilla/fenix/components/metrics/Event.kt @@ -225,7 +225,7 @@ sealed class Event { object OpenedTabSuggestionClicked : Event() object SetDefaultBrowserToolbarMenuClicked : Event() - + object ToolbarMenuShown : Event() // Interaction events with extras data class TopSiteSwipeCarousel(val page: Int) : Event() { diff --git a/app/src/main/java/org/mozilla/fenix/components/metrics/GleanMetricsService.kt b/app/src/main/java/org/mozilla/fenix/components/metrics/GleanMetricsService.kt index 5d8531e58f01..f565cafd6bb9 100644 --- a/app/src/main/java/org/mozilla/fenix/components/metrics/GleanMetricsService.kt +++ b/app/src/main/java/org/mozilla/fenix/components/metrics/GleanMetricsService.kt @@ -200,6 +200,9 @@ private val Event.wrapper: EventWrapper<*>? is Event.SetDefaultBrowserToolbarMenuClicked -> EventWrapper( { ExperimentsDefaultBrowser.toolbarMenuClicked.record(it) } ) + is Event.ToolbarMenuShown -> EventWrapper( + { Events.toolbarMenuVisible.record(it) } + ) is Event.ChangedToDefaultBrowser -> EventWrapper( { Events.defaultBrowserChanged.record(it) } ) diff --git a/app/src/main/java/org/mozilla/fenix/components/metrics/MetricController.kt b/app/src/main/java/org/mozilla/fenix/components/metrics/MetricController.kt index 181ff4ea2f6f..b2746326783d 100644 --- a/app/src/main/java/org/mozilla/fenix/components/metrics/MetricController.kt +++ b/app/src/main/java/org/mozilla/fenix/components/metrics/MetricController.kt @@ -179,7 +179,7 @@ internal class ReleaseMetricController( } Component.BROWSER_TOOLBAR to ToolbarFacts.Items.MENU -> { - metadata?.get("customTab")?.let { Event.CustomTabsMenuOpened } + metadata?.get("customTab")?.let { Event.CustomTabsMenuOpened } ?: Event.ToolbarMenuShown } Component.BROWSER_MENU to BrowserMenuFacts.Items.WEB_EXTENSION_MENU_ITEM -> { metadata?.get("id")?.let { Event.AddonsOpenInToolbarMenu(it.toString()) } diff --git a/app/src/main/java/org/mozilla/fenix/components/toolbar/DefaultToolbarMenu.kt b/app/src/main/java/org/mozilla/fenix/components/toolbar/DefaultToolbarMenu.kt index d2a2316704f7..66e0d40cc4cf 100644 --- a/app/src/main/java/org/mozilla/fenix/components/toolbar/DefaultToolbarMenu.kt +++ b/app/src/main/java/org/mozilla/fenix/components/toolbar/DefaultToolbarMenu.kt @@ -624,7 +624,8 @@ open class DefaultToolbarMenu( } } private fun getSetDefaultBrowserItem(): BrowserMenuImageText? { - val experiments = context.components.analytics.experiments + val analytics = context.components.analytics + val experiments = analytics.experiments val browsers = BrowsersCache.all(context) return experiments.withExperiment(Experiments.DEFAULT_BROWSER) { experimentBranch -> diff --git a/docs/metrics.md b/docs/metrics.md index 900b79c9393b..fd1523943f8d 100644 --- a/docs/metrics.md +++ b/docs/metrics.md @@ -143,6 +143,7 @@ In addition to those built-in metrics, the following metrics are added to the pi | events.set_default_browser_experiment |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |Indicates which branch let to user to set Firefox as a default browser |[mozilla-mobile/fenix#18895](https://github.com/mozilla-mobile/fenix/pull/18895)|
  • item: A string containing the experiment that let users to set their default browser to Firefox. These items include ToolbarMenu, SettingMenu and NewTabBanner
|2021-10-01 |2 | | events.synced_tab_opened |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |An event that indicates that a synced tab was opened. |[mozilla-mobile/fenix#16727](https://github.com/mozilla-mobile/fenix/pull/16727)||2021-05-10 |2 | | events.tab_counter_menu_action |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A tab counter menu item was tapped |[mozilla-mobile/fenix#11533](https://github.com/mozilla-mobile/fenix/pull/11533), [mozilla-mobile/fenix#13958](https://github.com/mozilla-mobile/fenix/pull/13958#issuecomment-676857877), [mozilla-mobile/fenix#18143](https://github.com/mozilla-mobile/fenix/pull/18143)|
  • item: A string containing the name of the item the user tapped. These items are: New tab, New private tab, Close tab
|2021-07-01 |2 | +| events.toolbar_menu_visible |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |The browser menu was displayed from toolbar menu |[mozilla-mobile/fenix#18895](https://github.com/mozilla-mobile/fenix/pull/18895)||2021-10-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 |[mozilla-mobile/fenix#5090](https://github.com/mozilla-mobile/fenix/pull/5090), [mozilla-mobile/fenix#13958](https://github.com/mozilla-mobile/fenix/pull/13958#issuecomment-676857877), [mozilla-mobile/fenix#18143](https://github.com/mozilla-mobile/fenix/pull/18143)||2021-07-01 |2 | | experiments_default_browser.toolbar_menu_clicked |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |Set default browser was clicked from toolbar menu |[mozilla-mobile/fenix#18895](https://github.com/mozilla-mobile/fenix/pull/18895)||2021-10-01 |2 | | find_in_page.closed |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user closed the find in page UI |[mozilla-mobile/fenix#1344](https://github.com/mozilla-mobile/fenix/pull/1344#issuecomment-479285010), [mozilla-mobile/fenix#15713](https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068)||2021-08-01 |2 |