diff --git a/app/metrics.yaml b/app/metrics.yaml index 7bbd7fc79..2c3ccff6c 100644 --- a/app/metrics.yaml +++ b/app/metrics.yaml @@ -1543,3 +1543,82 @@ experiments.metrics: notification_emails: - mcooper@mozilla.com expires: 2019-11-01 + +download_notification: + resume: + type: event + description: > + A user resumed a download in the download notification + bugs: + - https://github.com/mozilla-mobile/fenix/issues/5583 + data_reviews: + - https://github.com/mozilla-mobile/fenix/pull/6554 + notification_emails: + - fenix-core@mozilla.com + expires: "2020-03-01" + pause: + type: event + description: > + A user paused a download in the download notification + bugs: + - https://github.com/mozilla-mobile/fenix/issues/5583 + data_reviews: + - https://github.com/mozilla-mobile/fenix/pull/6554 + notification_emails: + - fenix-core@mozilla.com + expires: "2020-03-01" + cancel: + type: event + description: > + A user cancelled a download in the download notification + bugs: + - https://github.com/mozilla-mobile/fenix/issues/5583 + data_reviews: + - https://github.com/mozilla-mobile/fenix/pull/6554 + notification_emails: + - fenix-core@mozilla.com + expires: "2020-03-01" + try_again: + type: event + description: > + A user tapped on try again when a download fails in the download notification + bugs: + - https://github.com/mozilla-mobile/fenix/issues/5583 + data_reviews: + - https://github.com/mozilla-mobile/fenix/pull/6554 + notification_emails: + - fenix-core@mozilla.com + expires: "2020-03-01" + open: + type: event + description: > + A user opened a downloaded file in the download notification + bugs: + - https://github.com/mozilla-mobile/fenix/issues/5583 + data_reviews: + - https://github.com/mozilla-mobile/fenix/pull/6554 + notification_emails: + - fenix-core@mozilla.com + expires: "2020-03-01" + in_app_open: + type: event + description: > + A user opened a downloaded file in the in-app notification link + bugs: + - https://github.com/mozilla-mobile/fenix/issues/5583 + data_reviews: + - https://github.com/mozilla-mobile/fenix/pull/6554 + notification_emails: + - fenix-core@mozilla.com + expires: "2020-03-01" + in_app_try_again: + type: event + description: > + A user tapped on try again when a download fails in the in-app notification link + bugs: + - https://github.com/mozilla-mobile/fenix/issues/5583 + data_reviews: + - https://github.com/mozilla-mobile/fenix/pull/6554 + notification_emails: + - fenix-core@mozilla.com + expires: "2020-03-01" 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 19f035819..0f1ca812f 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 @@ -19,6 +19,7 @@ import org.mozilla.fenix.GleanMetrics.Collections import org.mozilla.fenix.GleanMetrics.ContextMenu import org.mozilla.fenix.GleanMetrics.CrashReporter import org.mozilla.fenix.GleanMetrics.CustomTab +import org.mozilla.fenix.GleanMetrics.DownloadNotification import org.mozilla.fenix.GleanMetrics.ErrorPage import org.mozilla.fenix.GleanMetrics.Events import org.mozilla.fenix.GleanMetrics.FindInPage @@ -382,6 +383,27 @@ private val Event.wrapper: EventWrapper<*>? is Event.MediaStopState -> EventWrapper( { MediaState.stop.record(it) } ) + is Event.InAppNotificationDownloadOpen -> EventWrapper( + { DownloadNotification.inAppOpen.record(it) } + ) + is Event.InAppNotificationDownloadTryAgain -> EventWrapper( + { DownloadNotification.inAppTryAgain.record(it) } + ) + is Event.NotificationDownloadCancel -> EventWrapper( + { DownloadNotification.cancel.record(it) } + ) + is Event.NotificationDownloadOpen -> EventWrapper( + { DownloadNotification.open.record(it) } + ) + is Event.NotificationDownloadPause -> EventWrapper( + { DownloadNotification.pause.record(it) } + ) + is Event.NotificationDownloadResume -> EventWrapper( + { DownloadNotification.resume.record(it) } + ) + is Event.NotificationDownloadTryAgain -> EventWrapper( + { DownloadNotification.tryAgain.record(it) } + ) is Event.NotificationMediaPlay -> EventWrapper( { MediaNotification.play.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 122da7a52..9bf6f8354 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 @@ -10,6 +10,7 @@ import mozilla.components.browser.search.SearchEngine import mozilla.components.browser.toolbar.facts.ToolbarFacts import mozilla.components.feature.contextmenu.facts.ContextMenuFacts 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.support.base.Component @@ -117,6 +118,13 @@ sealed class Event { object MediaPlayState : Event() object MediaPauseState : Event() object MediaStopState : Event() + object InAppNotificationDownloadOpen : Event() + object InAppNotificationDownloadTryAgain : Event() + object NotificationDownloadCancel : Event() + object NotificationDownloadOpen : Event() + object NotificationDownloadPause : Event() + object NotificationDownloadResume : Event() + object NotificationDownloadTryAgain : Event() object NotificationMediaPlay : Event() object NotificationMediaPause : Event() object TrackingProtectionTrackerList : Event() @@ -332,28 +340,29 @@ private fun Fact.toEvent(): Event? = when (Pair(component, item)) { Component.FEATURE_CUSTOMTABS to CustomTabsFacts.Items.CLOSE -> Event.CustomTabsClosed Component.FEATURE_CUSTOMTABS to CustomTabsFacts.Items.ACTION_BUTTON -> Event.CustomTabsActionTapped + Component.FEATURE_DOWNLOADS to DownloadsFacts.Items.NOTIFICATION -> { + when (action) { + Action.CANCEL -> Event.NotificationDownloadCancel + Action.OPEN -> Event.NotificationDownloadOpen + Action.PAUSE -> Event.NotificationDownloadPause + Action.RESUME -> Event.NotificationDownloadResume + Action.TRY_AGAIN -> Event.NotificationDownloadTryAgain + else -> null + } + } + Component.FEATURE_MEDIA to MediaFacts.Items.NOTIFICATION -> { when (action) { - Action.PLAY -> { - Event.NotificationMediaPlay - } - Action.PAUSE -> { - Event.NotificationMediaPause - } + Action.PLAY -> Event.NotificationMediaPlay + Action.PAUSE -> Event.NotificationMediaPause else -> null } } Component.FEATURE_MEDIA to MediaFacts.Items.STATE -> { when (action) { - Action.PLAY -> { - Event.MediaPlayState - } - Action.PAUSE -> { - Event.MediaPauseState - } - Action.STOP -> { - Event.MediaStopState - } + Action.PLAY -> Event.MediaPlayState + Action.PAUSE -> Event.MediaPauseState + Action.STOP -> Event.MediaStopState else -> null } } diff --git a/app/src/main/java/org/mozilla/fenix/downloads/DownloadNotificationBottomSheetDialog.kt b/app/src/main/java/org/mozilla/fenix/downloads/DownloadNotificationBottomSheetDialog.kt index c44a0ab99..fd98adae3 100644 --- a/app/src/main/java/org/mozilla/fenix/downloads/DownloadNotificationBottomSheetDialog.kt +++ b/app/src/main/java/org/mozilla/fenix/downloads/DownloadNotificationBottomSheetDialog.kt @@ -16,6 +16,8 @@ import mozilla.components.browser.state.state.content.DownloadState import mozilla.components.feature.downloads.AbstractFetchDownloadService import mozilla.components.feature.downloads.toMegabyteString import org.mozilla.fenix.R +import org.mozilla.fenix.components.metrics.Event +import org.mozilla.fenix.ext.metrics import org.mozilla.fenix.theme.ThemeManager class DownloadNotificationBottomSheetDialog( @@ -42,6 +44,7 @@ class DownloadNotificationBottomSheetDialog( ) setOnClickListener { tryAgain(download.id) + context.metrics.track(Event.InAppNotificationDownloadTryAgain) dismiss() } } @@ -66,6 +69,7 @@ class DownloadNotificationBottomSheetDialog( contentType = download.contentType, filePath = download.filePath ) + context.metrics.track(Event.InAppNotificationDownloadOpen) dismiss() } } diff --git a/docs/metrics.md b/docs/metrics.md index 24516ec04..8523c5a08 100644 --- a/docs/metrics.md +++ b/docs/metrics.md @@ -72,6 +72,13 @@ The following metrics are added to the ping: | custom_tab.action_button |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user pressed the action button provided by the launching app |[1](https://github.com/mozilla-mobile/fenix/pull/1697)||2020-03-01 | | custom_tab.closed |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user closed the custom tab |[1](https://github.com/mozilla-mobile/fenix/pull/1697)||2020-03-01 | | custom_tab.menu |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user opened the custom tabs menu |[1](https://github.com/mozilla-mobile/fenix/pull/1697)||2020-03-01 | +| download_notification.cancel |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user cancelled a download in the download notification |[1](https://github.com/mozilla-mobile/fenix/pull/6554)||2020-03-01 | +| download_notification.in_app_open |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user opened a downloaded file in the in-app notification link |[1](https://github.com/mozilla-mobile/fenix/pull/6554)||2020-03-01 | +| download_notification.in_app_try_again |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user tapped on try again when a download fails in the in-app notification link |[1](https://github.com/mozilla-mobile/fenix/pull/6554)||2020-03-01 | +| download_notification.open |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user opened a downloaded file in the download notification |[1](https://github.com/mozilla-mobile/fenix/pull/6554)||2020-03-01 | +| download_notification.pause |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user paused a download in the download notification |[1](https://github.com/mozilla-mobile/fenix/pull/6554)||2020-03-01 | +| download_notification.resume |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user resumed a download in the download notification |[1](https://github.com/mozilla-mobile/fenix/pull/6554)||2020-03-01 | +| download_notification.try_again |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user tapped on try again when a download fails in the download notification |[1](https://github.com/mozilla-mobile/fenix/pull/6554)||2020-03-01 | | error_page.visited_error |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user encountered an error page |[1](https://github.com/mozilla-mobile/fenix/pull/2491#issuecomment-492414486)|
  • error_type: The error type of the error page encountered
|2020-03-01 | | events.app_opened |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user opened the app |[1](https://github.com/mozilla-mobile/fenix/pull/1067#issuecomment-474598673)|
  • source: The method used to open Fenix. Possible values are: `app_icon`, `custom_tab` or `link`
|2020-03-01 | | events.browser_menu_action |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A browser menu item was tapped |[1](https://github.com/mozilla-mobile/fenix/pull/1214#issue-264756708), [2](https://github.com/mozilla-mobile/fenix/pull/5098#issuecomment-529658996), [3](https://github.com/mozilla-mobile/fenix/pull/6310)|
  • item: A string containing the name of the item the user tapped. These items include: Settings, Library, Help, Desktop Site toggle on/off, Find in Page, New Tab, Private Tab, Share, Report Site Issue, Back/Forward button, Reload Button, Quit, Reader Mode On, Reader Mode Off, Open In App
|2020-03-01 |