From 4b646c03cb27a3c3885807906d0ef7cf462868d9 Mon Sep 17 00:00:00 2001 From: Sawyer Blatz Date: Tue, 28 Jul 2020 17:22:05 -0700 Subject: [PATCH] For #9730: Add Login Dialog Prompt telemetry --- app/metrics.yaml | 46 +++++++++++++++++++ .../components/metrics/GleanMetricsService.kt | 13 ++++++ .../fenix/components/metrics/Metrics.kt | 11 +++++ docs/metrics.md | 4 ++ 4 files changed, 74 insertions(+) diff --git a/app/metrics.yaml b/app/metrics.yaml index 98cf7473a..77b359729 100644 --- a/app/metrics.yaml +++ b/app/metrics.yaml @@ -471,6 +471,52 @@ context_menu: - fenix-core@mozilla.com expires: "2020-10-01" +login_dialog: + displayed: + type: event + description: | + The login dialog prompt was displayed + bugs: + - https://github.com/mozilla-mobile/fenix/issues/9730 + data_reviews: + - https://github.com/mozilla-mobile/fenix/pull/13050 + notification_emails: + - fenix-core@mozilla.com + expires: "2021-02-01" + cancelled: + type: event + description: | + The login dialog prompt was cancelled + bugs: + - https://github.com/mozilla-mobile/fenix/issues/9730 + data_reviews: + - https://github.com/mozilla-mobile/fenix/pull/13050 + notification_emails: + - fenix-core@mozilla.com + expires: "2021-02-01" + saved: + type: event + description: | + The login dialog prompt "save" button was pressed + bugs: + - https://github.com/mozilla-mobile/fenix/issues/9730 + data_reviews: + - https://github.com/mozilla-mobile/fenix/pull/13050 + notification_emails: + - fenix-core@mozilla.com + expires: "2021-02-01" + never_save: + type: event + description: | + The login dialog prompt "never save" button was pressed + bugs: + - https://github.com/mozilla-mobile/fenix/issues/9730 + data_reviews: + - https://github.com/mozilla-mobile/fenix/pull/13050 + notification_emails: + - fenix-core@mozilla.com + expires: "2021-02-01" + find_in_page: opened: type: 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 755a3095a..55ebab4f2 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 @@ -24,6 +24,7 @@ import org.mozilla.fenix.GleanMetrics.ErrorPage import org.mozilla.fenix.GleanMetrics.Events import org.mozilla.fenix.GleanMetrics.FindInPage import org.mozilla.fenix.GleanMetrics.History +import org.mozilla.fenix.GleanMetrics.LoginDialog import org.mozilla.fenix.GleanMetrics.Logins import org.mozilla.fenix.GleanMetrics.MediaNotification import org.mozilla.fenix.GleanMetrics.MediaState @@ -140,6 +141,18 @@ private val Event.wrapper: EventWrapper<*>? { SearchShortcuts.selected.record(it) }, { SearchShortcuts.selectedKeys.valueOf(it) } ) + is Event.LoginDialogPromptDisplayed -> EventWrapper( + { LoginDialog.displayed.record(it) } + ) + is Event.LoginDialogPromptCancelled -> EventWrapper( + { LoginDialog.cancelled.record(it) } + ) + is Event.LoginDialogPromptSave -> EventWrapper( + { LoginDialog.saved.record(it) } + ) + is Event.LoginDialogPromptNeverSave -> EventWrapper( + { LoginDialog.neverSave.record(it) } + ) is Event.FindInPageOpened -> EventWrapper( { FindInPage.opened.record(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 676ba80a0..f6543991a 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 @@ -21,6 +21,7 @@ import mozilla.components.feature.customtabs.CustomTabsFacts import mozilla.components.feature.downloads.facts.DownloadsFacts import mozilla.components.feature.findinpage.facts.FindInPageFacts import mozilla.components.feature.media.facts.MediaFacts +import mozilla.components.feature.prompts.dialog.LoginDialogFacts import mozilla.components.support.base.Component import mozilla.components.support.base.facts.Action import mozilla.components.support.base.facts.Fact @@ -185,6 +186,11 @@ sealed class Event { object OnboardingFinish : Event() object ChangedToDefaultBrowser : Event() + object LoginDialogPromptDisplayed : Event() + object LoginDialogPromptCancelled : Event() + object LoginDialogPromptSave : Event() + object LoginDialogPromptNeverSave : Event() + object ContextualHintETPDisplayed : Event() object ContextualHintETPDismissed : Event() object ContextualHintETPOutsideTap : Event() @@ -514,6 +520,11 @@ sealed class Event { } private fun Fact.toEvent(): Event? = when (Pair(component, item)) { + Component.FEATURE_PROMPTS to LoginDialogFacts.Items.DISPLAY -> Event.LoginDialogPromptDisplayed + Component.FEATURE_PROMPTS to LoginDialogFacts.Items.CANCEL -> Event.LoginDialogPromptCancelled + Component.FEATURE_PROMPTS to LoginDialogFacts.Items.NEVER_SAVE -> Event.LoginDialogPromptNeverSave + Component.FEATURE_PROMPTS to LoginDialogFacts.Items.SAVE -> Event.LoginDialogPromptSave + Component.FEATURE_FINDINPAGE to FindInPageFacts.Items.CLOSE -> Event.FindInPageClosed Component.FEATURE_FINDINPAGE to FindInPageFacts.Items.INPUT -> Event.FindInPageSearchCommitted Component.FEATURE_CONTEXTMENU to ContextMenuFacts.Items.ITEM -> { diff --git a/docs/metrics.md b/docs/metrics.md index bc7162c1f..0ea774ade 100644 --- a/docs/metrics.md +++ b/docs/metrics.md @@ -118,6 +118,10 @@ The following metrics are added to the ping: | history.removed |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user removed a history item |[1](https://github.com/mozilla-mobile/fenix/pull/3940)||2020-10-01 | | | history.removed_all |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user removed all history items |[1](https://github.com/mozilla-mobile/fenix/pull/3940)||2020-10-01 | | | history.shared |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user shared a history item |[1](https://github.com/mozilla-mobile/fenix/pull/3940)||2020-10-01 | | +| login_dialog.cancelled |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |The login dialog prompt was cancelled |[1](https://github.com/mozilla-mobile/fenix/pull/13050)||2021-02-01 | | +| login_dialog.displayed |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |The login dialog prompt was displayed |[1](https://github.com/mozilla-mobile/fenix/pull/13050)||2021-02-01 | | +| login_dialog.never_save |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |The login dialog prompt "never save" button was pressed |[1](https://github.com/mozilla-mobile/fenix/pull/13050)||2021-02-01 | | +| login_dialog.saved |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |The login dialog prompt "save" button was pressed |[1](https://github.com/mozilla-mobile/fenix/pull/13050)||2021-02-01 | | | logins.copy_login |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user copied a piece of a login in saved logins |[1](https://github.com/mozilla-mobile/fenix/pull/6352)||2020-10-01 | | | logins.delete_saved_login |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user confirms delete of a saved login |[1](https://github.com/mozilla-mobile/fenix/issues/11208)||2020-10-01 | | | logins.open_individual_login |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user accessed an individual login in saved logins |[1](https://github.com/mozilla-mobile/fenix/pull/6352)||2020-10-01 | |