diff --git a/app/metrics.yaml b/app/metrics.yaml index e7a5732b09..91bed5e6bd 100644 --- a/app/metrics.yaml +++ b/app/metrics.yaml @@ -3110,6 +3110,45 @@ tabs_tray: notification_emails: - android-probes@mozilla.com expires: "2022-11-01" + inactive_tabs_cfr_settings: + type: event + description: | + A user has opened settings via the inactive tabs CFR. + bugs: + - https://github.com/mozilla-mobile/fenix/issues/22298 + data_reviews: + - https://github.com/mozilla-mobile/fenix/pull/22301 + data_sensitivity: + - interaction + notification_emails: + - android-probes@mozilla.com + expires: "2022-11-01" + inactive_tabs_cfr_dismissed: + type: event + description: | + A user has dismissed the inactive tabs CFR. + bugs: + - https://github.com/mozilla-mobile/fenix/issues/22298 + data_reviews: + - https://github.com/mozilla-mobile/fenix/pull/22301 + data_sensitivity: + - interaction + notification_emails: + - android-probes@mozilla.com + expires: "2022-11-01" + inactive_tabs_cfr_visible: + type: event + description: | + An indication of whether the inactive tabs CFR is visible. + bugs: + - https://github.com/mozilla-mobile/fenix/issues/22298 + data_reviews: + - https://github.com/mozilla-mobile/fenix/pull/22301 + data_sensitivity: + - interaction + notification_emails: + - android-probes@mozilla.com + expires: "2022-11-01" collections: renamed: 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 b4c23e9baf..30a4aaaa3a 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 @@ -212,6 +212,9 @@ sealed class Event { object TabsTrayCloseAllInactiveTabs : Event() data class TabsTrayCloseInactiveTab(val amountClosed: Int = 1) : Event() object TabsTrayOpenInactiveTab : Event() + object TabsTrayInactiveTabsCFRGotoSettings : Event() + object TabsTrayInactiveTabsCFRDismissed : Event() + object TabsTrayInactiveTabsCFRIsVisible : Event() object InactiveTabsSurveyOpened : Event() data class InactiveTabsOffSurvey(val feedback: String) : 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 b9f3e322f4..0ad39688bb 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 @@ -643,6 +643,15 @@ private val Event.wrapper: EventWrapper<*>? { Preferences.turnOffInactiveTabsSurvey.record(it) }, { Preferences.turnOffInactiveTabsSurveyKeys.valueOf(it) } ) + is Event.TabsTrayInactiveTabsCFRGotoSettings -> EventWrapper( + { TabsTray.inactiveTabsCfrSettings.record(it) } + ) + is Event.TabsTrayInactiveTabsCFRDismissed -> EventWrapper( + { TabsTray.inactiveTabsCfrDismissed.record(it) } + ) + is Event.TabsTrayInactiveTabsCFRIsVisible -> EventWrapper( + { TabsTray.inactiveTabsCfrVisible.record(it) } + ) is Event.AutoPlaySettingVisited -> EventWrapper( { Autoplay.visitedSetting.record(it) } ) diff --git a/app/src/main/java/org/mozilla/fenix/tabstray/TabsTrayInactiveTabsOnboardingBinding.kt b/app/src/main/java/org/mozilla/fenix/tabstray/TabsTrayInactiveTabsOnboardingBinding.kt index a4a382c27f..c7c89be234 100644 --- a/app/src/main/java/org/mozilla/fenix/tabstray/TabsTrayInactiveTabsOnboardingBinding.kt +++ b/app/src/main/java/org/mozilla/fenix/tabstray/TabsTrayInactiveTabsOnboardingBinding.kt @@ -27,8 +27,10 @@ import mozilla.components.support.ktx.android.util.dpToPx import mozilla.components.support.ktx.kotlinx.coroutines.flow.ifChanged import org.mozilla.fenix.R import org.mozilla.fenix.browser.infobanner.InfoBanner +import org.mozilla.fenix.components.metrics.Event import org.mozilla.fenix.databinding.ComponentTabstray2Binding import org.mozilla.fenix.databinding.OnboardingInactiveTabsCfrBinding +import org.mozilla.fenix.ext.components import org.mozilla.fenix.ext.potentialInactiveTabs import org.mozilla.fenix.utils.Settings @@ -62,6 +64,7 @@ class TabsTrayInactiveTabsOnboardingBinding( private fun createInactiveCFR() { val context: Context = context + val metrics = context.components.analytics.metrics val anchorPosition = IntArray(2) val popupBinding = OnboardingInactiveTabsCfrBinding.inflate(LayoutInflater.from(context)) val popup = Dialog(context) @@ -75,12 +78,14 @@ class TabsTrayInactiveTabsOnboardingBinding( popupBinding.closeInfoBanner.setOnClickListener { popup.dismiss() settings.shouldShowInactiveTabsOnboardingPopup = false + metrics.track(Event.TabsTrayInactiveTabsCFRDismissed) } popupBinding.bannerInfoMessage.setOnClickListener { popup.dismiss() settings.shouldShowInactiveTabsOnboardingPopup = false navigationInteractor.onTabSettingsClicked() + metrics.track(Event.TabsTrayInactiveTabsCFRGotoSettings) } val messageText = context.getString(R.string.tab_tray_inactive_onboarding_message) @@ -110,5 +115,6 @@ class TabsTrayInactiveTabsOnboardingBinding( setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT)) } popup.show() + metrics.track(Event.TabsTrayInactiveTabsCFRIsVisible) } }