diff --git a/app/metrics.yaml b/app/metrics.yaml index 4082f8016..04fced3ef 100644 --- a/app/metrics.yaml +++ b/app/metrics.yaml @@ -1243,6 +1243,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 11b6d528c..8aa869c9d 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 1cd13bc35..853b21dc3 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 d07262c86..0d4518a9c 100644 --- a/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt @@ -583,12 +583,16 @@ class HomeFragment : Fragment(), AccountObserver { ) layout.findViewById