diff --git a/app/metrics.yaml b/app/metrics.yaml index b1e66b457..4c2546e04 100644 --- a/app/metrics.yaml +++ b/app/metrics.yaml @@ -5207,3 +5207,31 @@ android_keystore_experiment: notification_emails: - fenix-core@mozilla.com expires: "2021-09-01" + +set_default_newtab_experiment: + set_default_browser_clicked: + type: event + description: | + Set default browser was clicked from new tab screen. + bugs: + - https://github.com/mozilla-mobile/fenix/issues/18853 + data_reviews: + - https://github.com/mozilla-mobile/fenix/pull/18895 + data_sensitivity: + - interaction + notification_emails: + - fenix-core@mozilla.com + expires: "2021-10-01" + close_experiment_card_clicked: + type: event + description: | + Close experiment card was clicked from new tab screen. + bugs: + - https://github.com/mozilla-mobile/fenix/issues/18853 + data_reviews: + - https://github.com/mozilla-mobile/fenix/pull/18895 + data_sensitivity: + - interaction + notification_emails: + - fenix-core@mozilla.com + expires: "2021-10-01" 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 01f2c1427..472747f52 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 @@ -224,6 +224,10 @@ sealed class Event { object SearchSuggestionClicked : Event() object OpenedTabSuggestionClicked : Event() + // Set default browser experiment metrics + object SetDefaultBrowserClicked : Event() + object CloseExperimentCardClicked : Event() + // Home menu interaction object HomeMenuSettingsItemClicked : 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 2c3ee37c8..807e31dfb 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 @@ -53,6 +53,7 @@ import org.mozilla.fenix.GleanMetrics.SearchDefaultEngine import org.mozilla.fenix.GleanMetrics.SearchShortcuts import org.mozilla.fenix.GleanMetrics.SearchSuggestions import org.mozilla.fenix.GleanMetrics.SearchWidget +import org.mozilla.fenix.GleanMetrics.SetDefaultNewtabExperiment import org.mozilla.fenix.GleanMetrics.SyncAccount import org.mozilla.fenix.GleanMetrics.SyncAuth import org.mozilla.fenix.GleanMetrics.SyncedTabs @@ -814,6 +815,13 @@ private val Event.wrapper: EventWrapper<*>? { HomeMenu.settingsItemClicked.record(it) } ) + is Event.CloseExperimentCardClicked -> EventWrapper( + { SetDefaultNewtabExperiment.closeExperimentCardClicked.record(it) } + ) + is Event.SetDefaultBrowserClicked -> EventWrapper( + { SetDefaultNewtabExperiment.setDefaultBrowserClicked.record(it) } + ) + // Don't record other events in Glean: is Event.AddBookmark -> null is Event.OpenedAppFirstRun -> null diff --git a/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/SessionControlController.kt b/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/SessionControlController.kt index 684fca0fc..62cd02563 100644 --- a/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/SessionControlController.kt +++ b/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/SessionControlController.kt @@ -567,11 +567,13 @@ class DefaultSessionControlController( override fun handleSetDefaultBrowser() { settings.userDismissedExperimentCard = true + metrics.track(Event.SetDefaultBrowserClicked) activity.openSetDefaultBrowserOption() } override fun handleCloseExperimentCard() { settings.userDismissedExperimentCard = true + metrics.track(Event.CloseExperimentCardClicked) fragmentStore.dispatch(HomeFragmentAction.RemoveSetDefaultBrowserCard) } } diff --git a/docs/metrics.md b/docs/metrics.md index bb13ad5e7..5c2c48c5e 100644 --- a/docs/metrics.md +++ b/docs/metrics.md @@ -206,6 +206,8 @@ In addition to those built-in metrics, the following metrics are added to the pi | search_suggestions.enable_in_private |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user enabled receiving search suggestions in private sessions |[mozilla-mobile/fenix#6746](https://github.com/mozilla-mobile/fenix/pull/6746), [mozilla-mobile/fenix#15713](https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068)||2021-08-01 |1, 2 | | search_widget.new_tab_button |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user pressed anywhere from the Firefox logo until the start of the microphone icon, opening a new tab search screen. |[mozilla-mobile/fenix#4714](https://github.com/mozilla-mobile/fenix/pull/4714), [mozilla-mobile/fenix#15713](https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068)||2021-08-01 |2 | | search_widget.voice_button |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user pressed the microphone icon, opening a new voice search screen. |[mozilla-mobile/fenix#4714](https://github.com/mozilla-mobile/fenix/pull/4714), [mozilla-mobile/fenix#15713](https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068)||2021-08-01 |2 | +| set_default_newtab_experiment.close_experiment_card_clicked |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |Close experiment card was clicked from new tab screen. |[mozilla-mobile/fenix#18895](https://github.com/mozilla-mobile/fenix/pull/18895)||2021-10-01 |2 | +| set_default_newtab_experiment.set_default_browser_clicked |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |Set default browser was clicked from new tab screen. |[mozilla-mobile/fenix#18895](https://github.com/mozilla-mobile/fenix/pull/18895)||2021-10-01 |2 | | sync_account.opened |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user opened the sync account page |[mozilla-mobile/fenix#2745](https://github.com/mozilla-mobile/fenix/pull/2745#issuecomment-494918532), [mozilla-mobile/fenix#15713](https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068)||2021-08-01 |2 | | sync_account.send_tab |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user sent the current tab to another FxA device |[mozilla-mobile/fenix#5106](https://github.com/mozilla-mobile/fenix/pull/5106), [mozilla-mobile/fenix#15713](https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068)||2021-08-01 |2 | | sync_account.sign_in_to_send_tab |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user pressed the "sign in to send tab" button inside the share tab menu |[mozilla-mobile/fenix#5106](https://github.com/mozilla-mobile/fenix/pull/5106), [mozilla-mobile/fenix#15713](https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068)||2021-08-01 |2 |