diff --git a/app/metrics.yaml b/app/metrics.yaml index 99b9f52b0223..d4a1482dbe52 100644 --- a/app/metrics.yaml +++ b/app/metrics.yaml @@ -595,6 +595,20 @@ experiments_default_browser: notification_emails: - fenix-core@mozilla.com expires: "2021-10-01" + menu_toolbar_visible: + type: event + description: | + Set default 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" + toolbar_settings: changed_position: type: event 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..7b406c773959 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 SetDefaultBrowserToolbarMenuShown : 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 c26415afaabf..a92c75d71c8c 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.SetDefaultBrowserToolbarMenuShown -> EventWrapper( + { ExperimentsDefaultBrowser.menuToolbarVisible.record(it) } + ) is Event.OpenedBookmark -> EventWrapper( { BookmarksManagement.open.record(it) } ) 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..5032db0fd4e0 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 @@ -39,6 +39,7 @@ import org.mozilla.fenix.FeatureFlags.tabsTrayRewrite import org.mozilla.fenix.HomeActivity import org.mozilla.fenix.R import org.mozilla.fenix.browser.browsingmode.BrowsingMode +import org.mozilla.fenix.components.metrics.Event import org.mozilla.fenix.experiments.ExperimentBranch import org.mozilla.fenix.experiments.Experiments import org.mozilla.fenix.ext.asActivity @@ -624,13 +625,16 @@ 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 -> if (experimentBranch == ExperimentBranch.DEFAULT_BROWSER_TOOLBAR_MENU && !browsers.isFirefoxDefaultBrowser ) { + analytics.metrics.track(Event.SetDefaultBrowserToolbarMenuShown) + return@withExperiment BrowserMenuImageText( label = context.getString(R.string.preferences_set_as_default_browser), imageResource = R.mipmap.ic_launcher diff --git a/docs/metrics.md b/docs/metrics.md index 6ea2d18c5e93..041e469cdce1 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.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.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.menu_toolbar_visible |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |Set default browser menu was displayed from toolbar menu |[mozilla-mobile/fenix#18895](https://github.com/mozilla-mobile/fenix/pull/18895)||2021-10-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 | | find_in_page.opened |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user opened 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 |