diff --git a/app/metrics.yaml b/app/metrics.yaml index 973757f2a16b..06530f97da15 100644 --- a/app/metrics.yaml +++ b/app/metrics.yaml @@ -3991,6 +3991,19 @@ top_sites: notification_emails: - android-probes@mozilla.com expires: "2022-02-01" + open_baidu_search_attribution: + type: event + description: | + A user opened the baidu top site + bugs: + - https://github.com/mozilla-mobile/fenix/issues/19490 + data_reviews: + - https://github.com/mozilla-mobile/fenix/pull/20705 + data_sensitivity: + - interaction + notification_emails: + - android-probes@mozilla.com + expires: "2022-02-01" open_frecency: type: event 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 20ac2cb5d2d9..65b270eaf7c3 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 @@ -129,6 +129,7 @@ sealed class Event { object NotificationMediaPause : Event() object TopSiteOpenDefault : Event() object TopSiteOpenGoogle : Event() + object TopSiteOpenBaidu : Event() object TopSiteOpenFrecent : Event() object TopSiteOpenPinned : Event() object TopSiteOpenInNewTab : 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 935576c4512b..1d6e05cb4d02 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 @@ -545,6 +545,9 @@ private val Event.wrapper: EventWrapper<*>? is Event.TopSiteOpenGoogle -> EventWrapper( { TopSites.openGoogleSearchAttribution.record(it) } ) + is Event.TopSiteOpenBaidu -> EventWrapper( + { TopSites.openBaiduSearchAttribution.record(it) } + ) is Event.TopSiteOpenFrecent -> EventWrapper( { TopSites.openFrecency.record(it) } ) 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 635def826595..5b3487074d17 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 @@ -392,6 +392,10 @@ class DefaultSessionControlController( metrics.track(Event.TopSiteOpenGoogle) } + if (url == SupportUtils.BAIDU_URL) { + metrics.track(Event.TopSiteOpenBaidu) + } + if (url == SupportUtils.POCKET_TRENDING_URL) { metrics.track(Event.PocketTopSiteClicked) }