Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Commit

Permalink
Map PWA facts to events
Browse files Browse the repository at this point in the history
  • Loading branch information
Elise Richards committed Jun 24, 2020
1 parent b76d957 commit 516f7c0
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
8 changes: 6 additions & 2 deletions app/metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2691,7 +2691,7 @@ perf.awesomebar:
- gkruglov@mozilla.com
expires: "2020-09-15"

progressive.web.app:
progressive_web_app:
homescreen_tap:
type: event
description: |
Expand All @@ -2707,7 +2707,7 @@ progressive.web.app:
install_menu_tap:
type: event
description: |
T bugs:
bugs:
- https://github.com/mozilla-mobile/fenix/issues/10261
data_reviews:
- https://github.com/mozilla-mobile/fenix/issues/10261
Expand All @@ -2731,6 +2731,10 @@ T bugs:
type: event
description: |
A user brings the PWA into the foreground after a specified time interval.
extra_keys:
duration:
description: |
The length of time in ms that the PWA was in the background
bugs:
- https://github.com/mozilla-mobile/fenix/issues/10261
data_reviews:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ 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.findinpage.facts.ProgressiveWebAppFacts
import mozilla.components.feature.media.facts.MediaFacts
import mozilla.components.support.base.Component
import mozilla.components.support.base.facts.Action
Expand Down Expand Up @@ -176,7 +177,6 @@ sealed class Event {
object ProgressiveWebAppHomescreenTap : Event()
object ProgressiveWebAppInstallMenuTap : Event()
object ProgressiveWebAppAddToHomescreenTap : Event()
object ProgressiveWebAppBringToForeground : Event()

// Interaction events with extras

Expand Down Expand Up @@ -445,6 +445,11 @@ sealed class Event {
get() = mapOf(Events.tabCounterMenuActionKeys.item to item.toString().toLowerCase(Locale.ROOT))
}

data class ProgressiveWebAppBringToForeground(val durationInBackground: Long) : Event() {
override val extras: Map<Events.enteredUrlKeys, String>?
get() = mapOf(ProgressiveWebApp.bringToForegroundKeys.duration to durationInBackground.toString())
}

sealed class Search

internal open val extras: Map<*, String>?
Expand Down Expand Up @@ -529,6 +534,12 @@ private fun Fact.toEvent(): Event? = when (Pair(component, item)) {
}
null
}
Component.FEATURE_PWA to ProgressiveWebAppFacts.Items.HOMESCREEN_ICON_TAP -> Event.FindInPageClosed
Component.FEATURE_PWA to ProgressiveWebAppFacts.Items.BACKGROUND_TIMING -> {
metadata?.get(ProgressiveWebAppFacts.MetadataKeys.BACKGROUND_DURATION)?.let { duration ->
Event.ProgressiveWebAppBringToForeground(duration) }
}
}
else -> null
}

Expand Down
8 changes: 4 additions & 4 deletions docs/metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,10 @@ The following metrics are added to the ping:
| private_browsing_shortcut.pinned_shortcut_priv |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user pressed the pinned private shortcut in Android home screen, opening up a new private search. |[1](https://github.com/mozilla-mobile/fenix/pull/5194)||2020-09-01 |
| private_browsing_shortcut.static_shortcut_priv |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user pressed the long-press shortcut "Open new private tab", opening up a new private search. |[1](https://github.com/mozilla-mobile/fenix/pull/5194)||2020-09-01 |
| private_browsing_shortcut.static_shortcut_tab |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user pressed the long-press shortcut "Open new tab", opening up a new search. |[1](https://github.com/mozilla-mobile/fenix/pull/5194)||2020-09-01 |
| progressive.web.app.add_to_homescreen_tap |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user taps the add to homescreen icon for a PWA |[1](https://github.com/mozilla-mobile/fenix/issues/10261)||2020-09-01 |
| progressive.web.app.bring_to_foreground |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user brings the PWA into the foreground after a specified time interval. |[1](https://github.com/mozilla-mobile/fenix/issues/10261)||2020-09-01 |
| progressive.web.app.homescreen_tap |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user taps on PWA homescreen icon |[1](https://github.com/mozilla-mobile/fenix/issues/10261)||2020-09-01 |
| progressive.web.app.install_menu_tap |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user opens the install PWA menu |[1](https://github.com/mozilla-mobile/fenix/issues/10261)||2020-09-01 |
| progressive_web_app.add_to_homescreen_tap |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user taps the add to homescreen icon for a PWA |[1](https://github.com/mozilla-mobile/fenix/issues/10261)||2020-09-01 |
| progressive_web_app.bring_to_foreground |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user brings the PWA into the foreground after a specified time interval. |[1](https://github.com/mozilla-mobile/fenix/issues/10261)|<ul><li>duration: The length of time in ms that the PWA was in the background </li></ul>|2020-09-01 |
| progressive_web_app.homescreen_tap |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user taps on PWA homescreen icon |[1](https://github.com/mozilla-mobile/fenix/issues/10261)||2020-09-01 |
| progressive_web_app.install_menu_tap |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) | |[1](https://github.com/mozilla-mobile/fenix/issues/10261)||2020-09-01 |
| qr_scanner.navigation_allowed |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user tapped "allow" on the prompt, directing the user to the website scanned |[1](https://github.com/mozilla-mobile/fenix/pull/2524#issuecomment-492739967)||2020-09-01 |
| qr_scanner.navigation_denied |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user tapped "deny" on the prompt, putting the user back to the scanning view |[1](https://github.com/mozilla-mobile/fenix/pull/2524#issuecomment-492739967)||2020-09-01 |
| qr_scanner.opened |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user opened the QR scanner |[1](https://github.com/mozilla-mobile/fenix/pull/2524#issuecomment-492739967)||2020-09-01 |
Expand Down

0 comments on commit 516f7c0

Please sign in to comment.