1
0
Fork 0

For #5197: Adds telemetry for media controls (#5266)

master
Sawyer Blatz 2019-09-20 14:49:27 -07:00 committed by GitHub
parent 77ce658033
commit 4a6e647167
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 37 additions and 0 deletions

View File

@ -1356,6 +1356,30 @@ private_browsing_shortcut:
- fenix-core@mozilla.com
expires: "2020-03-01"
tab:
media_play:
type: event
description: >
A user pressed the play icon on a tab from the home screen
bugs:
- 5197
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/5266
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"
media_pause:
type: event
description: >
A user pressed the pause icon on a tab from the home screen
bugs:
- 5197
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/5266
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"
experiments.metrics:
active_experiment:
type: string

View File

@ -36,6 +36,7 @@ import org.mozilla.fenix.GleanMetrics.SearchShortcuts
import org.mozilla.fenix.GleanMetrics.SearchWidget
import org.mozilla.fenix.GleanMetrics.SyncAccount
import org.mozilla.fenix.GleanMetrics.SyncAuth
import org.mozilla.fenix.GleanMetrics.Tab
import org.mozilla.fenix.ext.components
private class EventWrapper<T : Enum<T>>(
@ -370,6 +371,12 @@ private val Event.wrapper: EventWrapper<*>?
{ Events.whatsNewTapped.record(it) },
{ Events.whatsNewTappedKeys.valueOf(it) }
)
is Event.TabMediaPlay -> EventWrapper<NoExtraKeys>(
{ Tab.mediaPlay.record(it) }
)
is Event.TabMediaPause -> EventWrapper<NoExtraKeys>(
{ Tab.mediaPause.record(it) }
)
// Don't record other events in Glean:
is Event.AddBookmark -> null

View File

@ -113,6 +113,8 @@ sealed class Event {
object PrivateBrowsingPinnedShortcutPrivateTab : Event()
object PrivateBrowsingStaticShortcutTab : Event()
object PrivateBrowsingStaticShortcutPrivateTab : Event()
object TabMediaPlay : Event()
object TabMediaPause : Event()
// Interaction events with extras

View File

@ -63,10 +63,12 @@ class TabViewHolder(
play_pause_button.setOnClickListener {
when (tab?.mediaState) {
is MediaState.Playing -> {
it.context.components.analytics.metrics.track(Event.TabMediaPlay)
actionEmitter.onNext(TabAction.PauseMedia(tab?.sessionId!!))
}
is MediaState.Paused -> {
it.context.components.analytics.metrics.track(Event.TabMediaPause)
actionEmitter.onNext(TabAction.PlayMedia(tab?.sessionId!!))
}
}

View File

@ -138,6 +138,8 @@ The following metrics are added to the ping:
| sync_auth.sign_in |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user pressed the sign in button on the sync authentication page and was successfully signed in to FxA |[1](https://github.com/mozilla-mobile/fenix/pull/2745#issuecomment-494918532)||2020-03-01 |
| sync_auth.sign_out |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user pressed the sign out button on the sync account page and was successfully signed out of FxA |[1](https://github.com/mozilla-mobile/fenix/pull/2745#issuecomment-494918532)||2020-03-01 |
| sync_auth.sign_up |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |User registered a new Firefox Account, and was signed into it |[1](https://github.com/mozilla-mobile/fenix/pull/4931#issuecomment-529740300)||2020-03-01 |
| tab.media_pause |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user pressed the pause icon on a tab from the home screen |[1](https://github.com/mozilla-mobile/fenix/pull/5266)||2020-03-01 |
| tab.media_play |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user pressed the play icon on a tab from the home screen |[1](https://github.com/mozilla-mobile/fenix/pull/5266)||2020-03-01 |
## metrics
This is a built-in ping that is assembled out of the box by the Glean SDK.