For #15367 - DownloadsFragment telemetry (#16728)

Adds a counter for how many times the user does the following action:
- opens the Downloads section inside the app
- tap to open an item from inside Downloads / from the download dialog
- tap to delete one or more downloads at once
upstream-sync
Mugurell 4 years ago committed by GitHub
parent d5b33aec43
commit 574eac4636
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -3124,6 +3124,51 @@ downloads_misc:
- fenix-core@mozilla.com - fenix-core@mozilla.com
expires: "2021-04-01" expires: "2021-04-01"
downloads_management:
downloads_screen_opened:
type: event
description: >
A counter for the number of times users access the "Downloads" folder
inside the app.
send_in_pings:
- metrics
bugs:
- https://github.com/mozilla-mobile/fenix/issues/15367
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/16728
notification_emails:
- fenix-core@mozilla.com
expires: "2021-04-01"
item_opened:
type: event
description: >
A counter for how often a user tap to opens a download from inside the
"Downloads" folder.
send_in_pings:
- metrics
bugs:
- https://github.com/mozilla-mobile/fenix/issues/15367
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/16728
notification_emails:
- fenix-core@mozilla.com
expires: "2021-04-01"
item_deleted:
type: event
description: >
A counter for how often a user deletes one / more downloads at a time.
send_in_pings:
- metrics
bugs:
- https://github.com/mozilla-mobile/fenix/issues/15367
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/16728
notification_emails:
- fenix-core@mozilla.com
expires: "2021-04-01"
user_specified_search_engines: user_specified_search_engines:
custom_engine_added: custom_engine_added:
type: event type: event

@ -472,6 +472,7 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler,
val dynamicDownloadDialog = DynamicDownloadDialog( val dynamicDownloadDialog = DynamicDownloadDialog(
container = view.browserLayout, container = view.browserLayout,
downloadState = downloadState, downloadState = downloadState,
metrics = requireComponents.analytics.metrics,
didFail = downloadJobStatus == DownloadState.Status.FAILED, didFail = downloadJobStatus == DownloadState.Status.FAILED,
tryAgain = downloadFeature::tryAgain, tryAgain = downloadFeature::tryAgain,
onCannotOpenFile = { onCannotOpenFile = {
@ -786,6 +787,7 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler,
DynamicDownloadDialog( DynamicDownloadDialog(
container = view.browserLayout, container = view.browserLayout,
downloadState = savedDownloadState.first, downloadState = savedDownloadState.first,
metrics = requireComponents.analytics.metrics,
didFail = savedDownloadState.second, didFail = savedDownloadState.second,
tryAgain = onTryAgain, tryAgain = onTryAgain,
onCannotOpenFile = onCannotOpenFile, onCannotOpenFile = onCannotOpenFile,

@ -114,6 +114,9 @@ sealed class Event {
object NotificationDownloadResume : Event() object NotificationDownloadResume : Event()
object NotificationDownloadTryAgain : Event() object NotificationDownloadTryAgain : Event()
object DownloadAdded : Event() object DownloadAdded : Event()
object DownloadsScreenOpened : Event()
object DownloadsItemOpened : Event()
object DownloadsItemDeleted : Event()
object NotificationMediaPlay : Event() object NotificationMediaPlay : Event()
object NotificationMediaPause : Event() object NotificationMediaPause : Event()
object TopSiteOpenDefault : Event() object TopSiteOpenDefault : Event()

@ -26,6 +26,7 @@ import org.mozilla.fenix.GleanMetrics.CrashReporter
import org.mozilla.fenix.GleanMetrics.CustomTab import org.mozilla.fenix.GleanMetrics.CustomTab
import org.mozilla.fenix.GleanMetrics.DownloadNotification import org.mozilla.fenix.GleanMetrics.DownloadNotification
import org.mozilla.fenix.GleanMetrics.DownloadsMisc import org.mozilla.fenix.GleanMetrics.DownloadsMisc
import org.mozilla.fenix.GleanMetrics.DownloadsManagement
import org.mozilla.fenix.GleanMetrics.ErrorPage import org.mozilla.fenix.GleanMetrics.ErrorPage
import org.mozilla.fenix.GleanMetrics.Events import org.mozilla.fenix.GleanMetrics.Events
import org.mozilla.fenix.GleanMetrics.FindInPage import org.mozilla.fenix.GleanMetrics.FindInPage
@ -427,6 +428,15 @@ private val Event.wrapper: EventWrapper<*>?
is Event.DownloadAdded -> EventWrapper<NoExtraKeys>( is Event.DownloadAdded -> EventWrapper<NoExtraKeys>(
{ DownloadsMisc.downloadAdded.record(it) } { DownloadsMisc.downloadAdded.record(it) }
) )
is Event.DownloadsScreenOpened -> EventWrapper<NoExtraKeys>(
{ DownloadsManagement.downloadsScreenOpened.record(it) }
)
is Event.DownloadsItemOpened -> EventWrapper<NoExtraKeys>(
{ DownloadsManagement.itemOpened.record(it) }
)
is Event.DownloadsItemDeleted -> EventWrapper<NoExtraKeys>(
{ DownloadsManagement.itemDeleted.record(it) }
)
is Event.NotificationMediaPlay -> EventWrapper<NoExtraKeys>( is Event.NotificationMediaPlay -> EventWrapper<NoExtraKeys>(
{ MediaNotification.play.record(it) } { MediaNotification.play.record(it) }
) )

@ -14,6 +14,7 @@ import mozilla.components.feature.downloads.AbstractFetchDownloadService
import mozilla.components.feature.downloads.toMegabyteOrKilobyteString import mozilla.components.feature.downloads.toMegabyteOrKilobyteString
import org.mozilla.fenix.R import org.mozilla.fenix.R
import org.mozilla.fenix.components.metrics.Event import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.components.metrics.MetricController
import org.mozilla.fenix.ext.metrics import org.mozilla.fenix.ext.metrics
import org.mozilla.fenix.ext.settings import org.mozilla.fenix.ext.settings
@ -26,6 +27,7 @@ import org.mozilla.fenix.ext.settings
class DynamicDownloadDialog( class DynamicDownloadDialog(
private val container: ViewGroup, private val container: ViewGroup,
private val downloadState: DownloadState?, private val downloadState: DownloadState?,
private val metrics: MetricController,
private val didFail: Boolean, private val didFail: Boolean,
private val tryAgain: (String) -> Unit, private val tryAgain: (String) -> Unit,
private val onCannotOpenFile: () -> Unit, private val onCannotOpenFile: () -> Unit,
@ -99,6 +101,8 @@ class DynamicDownloadDialog(
mozilla.components.feature.downloads.R.string.mozac_feature_downloads_button_open mozilla.components.feature.downloads.R.string.mozac_feature_downloads_button_open
) )
setOnClickListener { setOnClickListener {
metrics.track(Event.DownloadsItemOpened)
val fileWasOpened = AbstractFetchDownloadService.openFile( val fileWasOpened = AbstractFetchDownloadService.openFile(
context = context, context = context,
contentType = downloadState.contentType, contentType = downloadState.contentType,

@ -32,6 +32,8 @@ import org.mozilla.fenix.R
import org.mozilla.fenix.addons.showSnackBar import org.mozilla.fenix.addons.showSnackBar
import org.mozilla.fenix.browser.browsingmode.BrowsingMode import org.mozilla.fenix.browser.browsingmode.BrowsingMode
import org.mozilla.fenix.components.StoreProvider import org.mozilla.fenix.components.StoreProvider
import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.components.metrics.MetricController
import org.mozilla.fenix.ext.components import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.filterNotExistsOnDisk import org.mozilla.fenix.ext.filterNotExistsOnDisk
import org.mozilla.fenix.ext.requireComponents import org.mozilla.fenix.ext.requireComponents
@ -45,6 +47,7 @@ class DownloadFragment : LibraryPageFragment<DownloadItem>(), UserInteractionHan
private lateinit var downloadStore: DownloadFragmentStore private lateinit var downloadStore: DownloadFragmentStore
private lateinit var downloadView: DownloadView private lateinit var downloadView: DownloadView
private lateinit var downloadInteractor: DownloadInteractor private lateinit var downloadInteractor: DownloadInteractor
private lateinit var metrics: MetricController
private var undoScope: CoroutineScope? = null private var undoScope: CoroutineScope? = null
private var pendingDownloadDeletionJob: (suspend () -> Unit)? = null private var pendingDownloadDeletionJob: (suspend () -> Unit)? = null
@ -109,9 +112,13 @@ class DownloadFragment : LibraryPageFragment<DownloadItem>(), UserInteractionHan
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setHasOptionsMenu(true) setHasOptionsMenu(true)
metrics = requireComponents.analytics.metrics
metrics.track(Event.DownloadsScreenOpened)
} }
private fun displayDeleteAll() { private fun displayDeleteAll() {
metrics.track(Event.DownloadsItemDeleted)
activity?.let { activity -> activity?.let { activity ->
AlertDialog.Builder(activity).apply { AlertDialog.Builder(activity).apply {
setMessage(R.string.download_delete_all_dialog) setMessage(R.string.download_delete_all_dialog)
@ -140,6 +147,8 @@ class DownloadFragment : LibraryPageFragment<DownloadItem>(), UserInteractionHan
} }
private fun deleteDownloadItems(items: Set<DownloadItem>) { private fun deleteDownloadItems(items: Set<DownloadItem>) {
metrics.track(Event.DownloadsItemDeleted)
updatePendingDownloadToDelete(items) updatePendingDownloadToDelete(items)
undoScope = CoroutineScope(IO) undoScope = CoroutineScope(IO)
undoScope?.allowUndo( undoScope?.allowUndo(
@ -233,6 +242,8 @@ class DownloadFragment : LibraryPageFragment<DownloadItem>(), UserInteractionHan
filePath = item.filePath filePath = item.filePath
) )
} }
metrics.track(Event.DownloadsItemOpened)
} }
private fun getDeleteDownloadItemsOperation(items: Set<DownloadItem>): (suspend () -> Unit) { private fun getDeleteDownloadItemsOperation(items: Set<DownloadItem>): (suspend () -> Unit) {

@ -261,6 +261,9 @@ The following metrics are added to the ping:
| browser.search.ad_clicks |[labeled_counter](https://mozilla.github.io/glean/book/user/metrics/labeled_counters.html) |Records clicks of adverts on SERP pages. The key format is <provider-name>. |[1](https://github.com/mozilla-mobile/fenix/pull/10112), [2](https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068)||2021-08-01 |2 | | browser.search.ad_clicks |[labeled_counter](https://mozilla.github.io/glean/book/user/metrics/labeled_counters.html) |Records clicks of adverts on SERP pages. The key format is <provider-name>. |[1](https://github.com/mozilla-mobile/fenix/pull/10112), [2](https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068)||2021-08-01 |2 |
| browser.search.in_content |[labeled_counter](https://mozilla.github.io/glean/book/user/metrics/labeled_counters.html) |Records the type of interaction a user has on SERP pages. |[1](https://github.com/mozilla-mobile/fenix/pull/10167), [2](https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068)||2021-08-01 |2 | | browser.search.in_content |[labeled_counter](https://mozilla.github.io/glean/book/user/metrics/labeled_counters.html) |Records the type of interaction a user has on SERP pages. |[1](https://github.com/mozilla-mobile/fenix/pull/10167), [2](https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068)||2021-08-01 |2 |
| browser.search.with_ads |[labeled_counter](https://mozilla.github.io/glean/book/user/metrics/labeled_counters.html) |Records counts of SERP pages with adverts displayed. The key format is <provider-name>. |[1](https://github.com/mozilla-mobile/fenix/pull/10112), [2](https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068)||2021-08-01 |2 | | browser.search.with_ads |[labeled_counter](https://mozilla.github.io/glean/book/user/metrics/labeled_counters.html) |Records counts of SERP pages with adverts displayed. The key format is <provider-name>. |[1](https://github.com/mozilla-mobile/fenix/pull/10112), [2](https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068)||2021-08-01 |2 |
| downloads_management.downloads_screen_opened |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A counter for the number of times users access the "Downloads" folder inside the app. |[1](https://github.com/mozilla-mobile/fenix/pull/16728)||2021-04-01 | |
| downloads_management.item_deleted |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A counter for how often a user deletes one / more downloads at a time. |[1](https://github.com/mozilla-mobile/fenix/pull/16728)||2021-04-01 | |
| downloads_management.item_opened |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A counter for how often a user tap to opens a download from inside the "Downloads" folder. |[1](https://github.com/mozilla-mobile/fenix/pull/16728)||2021-04-01 | |
| downloads_misc.download_added |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A counter for how many times something is downloaded in the app. |[1](https://github.com/mozilla-mobile/fenix/pull/16730)||2021-04-01 | | | downloads_misc.download_added |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A counter for how many times something is downloaded in the app. |[1](https://github.com/mozilla-mobile/fenix/pull/16730)||2021-04-01 | |
| events.total_uri_count |[counter](https://mozilla.github.io/glean/book/user/metrics/counter.html) |A counter of URIs visited by the user in the current session, including page reloads. This does not include background page requests and URIs from embedded pages or private browsing but may be incremented without user interaction by website scripts that programmatically redirect to a new location. |[1](https://github.com/mozilla-mobile/fenix/pull/1785), [2](https://github.com/mozilla-mobile/fenix/pull/8314), [3](https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068)||2021-08-01 |2 | | events.total_uri_count |[counter](https://mozilla.github.io/glean/book/user/metrics/counter.html) |A counter of URIs visited by the user in the current session, including page reloads. This does not include background page requests and URIs from embedded pages or private browsing but may be incremented without user interaction by website scripts that programmatically redirect to a new location. |[1](https://github.com/mozilla-mobile/fenix/pull/1785), [2](https://github.com/mozilla-mobile/fenix/pull/8314), [3](https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068)||2021-08-01 |2 |
| metrics.adjust_ad_group |[string](https://mozilla.github.io/glean/book/user/metrics/string.html) |A string containing the Adjust ad group ID from which the user installed Fenix. This will not send on the first session the user runs. If the install is organic, this will be empty. |[1](https://github.com/mozilla-mobile/fenix/pull/9253), [2](https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068)||2021-08-01 |2 | | metrics.adjust_ad_group |[string](https://mozilla.github.io/glean/book/user/metrics/string.html) |A string containing the Adjust ad group ID from which the user installed Fenix. This will not send on the first session the user runs. If the install is organic, this will be empty. |[1](https://github.com/mozilla-mobile/fenix/pull/9253), [2](https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068)||2021-08-01 |2 |

Loading…
Cancel
Save