diff --git a/app/metrics.yaml b/app/metrics.yaml index 7d4825d2fdb0..c63d2c294f62 100644 --- a/app/metrics.yaml +++ b/app/metrics.yaml @@ -5813,3 +5813,30 @@ set_default_setting_experiment: notification_emails: - firefox-android-team@mozilla.com expires: "2021-10-01" +start_on_home: + enter_home_screen: + type: event + description: | + Know how often user lands on Homescreen upon opening the app. + bugs: + - https://github.com/mozilla-mobile/fenix/issues/19881 + data_reviews: + - https://github.com/mozilla-mobile/fenix/pull/19885 + data_sensitivity: + - interaction + notification_emails: + - fenix-core@mozilla.com + expires: "2022-06-16" + open_tabs_tray: + type: event + description: | + Know how often users open the tab tray. + bugs: + - https://github.com/mozilla-mobile/fenix/issues/19881 + data_reviews: + - https://github.com/mozilla-mobile/fenix/pull/19885 + data_sensitivity: + - interaction + notification_emails: + - fenix-core@mozilla.com + expires: "2022-06-16" diff --git a/app/src/main/java/org/mozilla/fenix/HomeActivity.kt b/app/src/main/java/org/mozilla/fenix/HomeActivity.kt index cfa0e82b9c2a..390f9e2c917b 100644 --- a/app/src/main/java/org/mozilla/fenix/HomeActivity.kt +++ b/app/src/main/java/org/mozilla/fenix/HomeActivity.kt @@ -223,6 +223,8 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity { shouldNavigateBrowserFragmentOnCouldStart(savedInstanceState) ) { navigateToBrowserOnColdStart() + } else { + components.analytics.metrics.track(Event.StartOnHomeEnterHomeScreen) } Performance.processIntentIfPerformanceTest(intent, this) 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 149c72889eb4..261744a36c5f 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 @@ -239,6 +239,10 @@ sealed class Event { // Browser Toolbar object BrowserToolbarHomeButtonClicked : Event() + // Start on Home + object StartOnHomeEnterHomeScreen : Event() + object StartOnHomeOpenTabsTray : 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 4d5894735292..01d916ea6579 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 @@ -51,6 +51,7 @@ import org.mozilla.fenix.GleanMetrics.SearchSuggestions import org.mozilla.fenix.GleanMetrics.SearchWidget import org.mozilla.fenix.GleanMetrics.SetDefaultNewtabExperiment import org.mozilla.fenix.GleanMetrics.SetDefaultSettingExperiment +import org.mozilla.fenix.GleanMetrics.StartOnHome import org.mozilla.fenix.GleanMetrics.SyncAccount import org.mozilla.fenix.GleanMetrics.SyncAuth import org.mozilla.fenix.GleanMetrics.SyncedTabs @@ -841,6 +842,14 @@ private val Event.wrapper: EventWrapper<*>? { Events.browserToolbarHomeTapped.record(it) } ) + is Event.StartOnHomeEnterHomeScreen -> EventWrapper( + { StartOnHome.enterHomeScreen.record(it) } + ) + + is Event.StartOnHomeOpenTabsTray -> EventWrapper( + { StartOnHome.openTabsTray.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/HomeFragment.kt b/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt index 93c07070eba4..652b67aa626b 100644 --- a/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt @@ -416,6 +416,7 @@ class HomeFragment : Fragment() { } view.tab_button.setOnClickListener { + requireComponents.analytics.metrics.track(Event.StartOnHomeOpenTabsTray) openTabsTray() }