From 7885faab26887a4e271bb7ebb71be69592854081 Mon Sep 17 00:00:00 2001 From: Yeon Taek Jeong Date: Tue, 10 Sep 2019 09:42:46 -0700 Subject: [PATCH] For #4658: Add private browsing mode shortcut telemetry --- app/metrics.yaml | 68 +++++++++++++++++++ .../components/metrics/GleanMetricsService.kt | 19 ++++++ .../fenix/components/metrics/Metrics.kt | 6 ++ .../org/mozilla/fenix/home/HomeFragment.kt | 6 +- .../home/intent/StartSearchIntentProcessor.kt | 3 + .../fenix/settings/SettingsFragment.kt | 2 + docs/metrics.md | 54 +++++++++++++++ 7 files changed, 157 insertions(+), 1 deletion(-) diff --git a/app/metrics.yaml b/app/metrics.yaml index a8290fb3c0b0..08c01c65e947 100644 --- a/app/metrics.yaml +++ b/app/metrics.yaml @@ -1237,6 +1237,74 @@ private_browsing_mode: - fenix-core@mozilla.com expires: "2020-03-01" +private_browsing_shortcut: + create_shortcut: + type: event + description: > + A user pressed the "Add private browsing shortcut" button in settings. + bugs: + - 4658 + data_reviews: + - https://github.com/mozilla-mobile/fenix/pull/5194 + notification_emails: + - fenix-core@mozilla.com + expires: "2020-03-01" + cfr_add_shortcut: + type: event + description: > + A user pressed the "Add shortcut" button when the contextual feature recommender appeared. + bugs: + - 4658 + data_reviews: + - https://github.com/mozilla-mobile/fenix/pull/5194 + notification_emails: + - fenix-core@mozilla.com + expires: "2020-03-01" + cfr_cancel: + type: event + description: > + A user pressed the "No thanks" button when the contextual feature recommender appeared. + bugs: + - 4658 + data_reviews: + - https://github.com/mozilla-mobile/fenix/pull/5194 + notification_emails: + - fenix-core@mozilla.com + expires: "2020-03-01" + pinned_shortcut_priv: + type: event + description: > + A user pressed the pinned private shortcut in Android home screen, opening up a new private search. + bugs: + - 4658 + data_reviews: + - https://github.com/mozilla-mobile/fenix/pull/5194 + notification_emails: + - fenix-core@mozilla.com + expires: "2020-03-01" + static_shortcut_tab: + type: event + description: > + A user pressed the long-press shortcut "Open new tab", opening up a new search. + bugs: + - 4658 + data_reviews: + - https://github.com/mozilla-mobile/fenix/pull/5194 + notification_emails: + - fenix-core@mozilla.com + expires: "2020-03-01" + static_shortcut_priv: + type: event + description: > + A user pressed the long-press shortcut "Open new private tab", opening up a new private search. + bugs: + - 4658 + data_reviews: + - https://github.com/mozilla-mobile/fenix/pull/5194 + notification_emails: + - fenix-core@mozilla.com + expires: "2020-03-01" + experiments.metrics: active_experiment: type: string 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 11b6d528cd3e..8aa869c9df34 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 @@ -28,6 +28,7 @@ import org.mozilla.fenix.GleanMetrics.Library import org.mozilla.fenix.GleanMetrics.Metrics import org.mozilla.fenix.GleanMetrics.Pings import org.mozilla.fenix.GleanMetrics.PrivateBrowsingMode +import org.mozilla.fenix.GleanMetrics.PrivateBrowsingShortcut import org.mozilla.fenix.GleanMetrics.QrScanner import org.mozilla.fenix.GleanMetrics.QuickActionSheet import org.mozilla.fenix.GleanMetrics.ReaderMode @@ -336,6 +337,24 @@ private val Event.wrapper: EventWrapper<*>? is Event.PrivateBrowsingNotificationDeleteAndOpenTapped -> EventWrapper( { PrivateBrowsingMode.notificationDelete.record(it) } ) + is Event.PrivateBrowsingCreateShortcut -> EventWrapper( + { PrivateBrowsingShortcut.createShortcut.record(it) } + ) + is Event.PrivateBrowsingAddShortcutCFR -> EventWrapper( + { PrivateBrowsingShortcut.cfrAddShortcut.record(it) } + ) + is Event.PrivateBrowsingCancelCFR -> EventWrapper( + { PrivateBrowsingShortcut.cfrCancel.record(it) } + ) + is Event.PrivateBrowsingPinnedShortcutPrivateTab -> EventWrapper( + { PrivateBrowsingShortcut.pinnedShortcutPriv.record(it) } + ) + is Event.PrivateBrowsingStaticShortcutTab -> EventWrapper( + { PrivateBrowsingShortcut.staticShortcutTab.record(it) } + ) + is Event.PrivateBrowsingStaticShortcutPrivateTab -> EventWrapper( + { PrivateBrowsingShortcut.staticShortcutPriv.record(it) } + ) is Event.WhatsNewTapped -> EventWrapper( { Events.whatsNewTapped.record(it) }, { Events.whatsNewTappedKeys.valueOf(it) } diff --git a/app/src/main/java/org/mozilla/fenix/components/metrics/Metrics.kt b/app/src/main/java/org/mozilla/fenix/components/metrics/Metrics.kt index 1cd13bc355b9..853b21dc3f9d 100644 --- a/app/src/main/java/org/mozilla/fenix/components/metrics/Metrics.kt +++ b/app/src/main/java/org/mozilla/fenix/components/metrics/Metrics.kt @@ -103,6 +103,12 @@ sealed class Event { object PrivateBrowsingNotificationTapped : Event() object PrivateBrowsingNotificationOpenTapped : Event() object PrivateBrowsingNotificationDeleteAndOpenTapped : Event() + object PrivateBrowsingCreateShortcut : Event() + object PrivateBrowsingAddShortcutCFR : Event() + object PrivateBrowsingCancelCFR : Event() + object PrivateBrowsingPinnedShortcutPrivateTab : Event() + object PrivateBrowsingStaticShortcutTab : Event() + object PrivateBrowsingStaticShortcutPrivateTab : Event() // Interaction events with extras 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 4cd71f06c1c7..127e9ac381c5 100644 --- a/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt @@ -571,12 +571,16 @@ class HomeFragment : Fragment(), AccountObserver { ) layout.findViewById