* Add PWA events to metrics. Track events for add to homescreen and install. Map PWA facts to events * Map component facts to local metrics Add events pings to fragments Supress long method for events Move install event to AC and collect facts Retrieve fg and bg events from Facts. Do not track intent fg/bg events, only views * Allow onPause in base fragment to send telemetry for PWA in the external app fragment. Track foreground and bg locally in fenix, and route install and home screen taps from AC facts * Rebasemaster
parent
3cb1acc35a
commit
3e8cab19c0
|
@ -3315,3 +3315,61 @@ storage.stats:
|
|||
- perf-android-fe@mozilla.com
|
||||
- mcomella@mozilla.com
|
||||
expires: "2021-02-01"
|
||||
|
||||
progressive_web_app:
|
||||
homescreen_tap:
|
||||
type: event
|
||||
description: |
|
||||
A user taps on PWA homescreen icon
|
||||
bugs:
|
||||
- https://github.com/mozilla-mobile/fenix/issues/10261
|
||||
data_reviews:
|
||||
- https://github.com/mozilla-mobile/fenix/pull/11859
|
||||
notification_emails:
|
||||
- fenix-core@mozilla.com
|
||||
- erichards@mozilla.com
|
||||
expires: "2021-03-01"
|
||||
install_tap:
|
||||
type: event
|
||||
description: |
|
||||
A user installs a PWA. Could be a shortcut or added to homescreen.
|
||||
bugs:
|
||||
- https://github.com/mozilla-mobile/fenix/issues/10261
|
||||
data_reviews:
|
||||
- https://github.com/mozilla-mobile/fenix/pull/11859
|
||||
notification_emails:
|
||||
- fenix-core@mozilla.com
|
||||
- erichards@mozilla.com
|
||||
expires: "2021-03-01"
|
||||
foreground:
|
||||
type: event
|
||||
description: |
|
||||
A user brings the PWA into the foreground.
|
||||
extra_keys:
|
||||
time_ms:
|
||||
description: |
|
||||
The current time in ms when the PWA was brought to the foreground.
|
||||
bugs:
|
||||
- https://github.com/mozilla-mobile/fenix/issues/10261
|
||||
data_reviews:
|
||||
- https://github.com/mozilla-mobile/fenix/pull/11859
|
||||
notification_emails:
|
||||
- fenix-core@mozilla.com
|
||||
- erichards@mozilla.com
|
||||
expires: "2021-03-01"
|
||||
background:
|
||||
type: event
|
||||
description: |
|
||||
A user puts the PWA into the background.
|
||||
extra_keys:
|
||||
time_ms:
|
||||
description: |
|
||||
The current time in ms when the PWA was backgrounded.
|
||||
bugs:
|
||||
- https://github.com/mozilla-mobile/fenix/issues/10261
|
||||
data_reviews:
|
||||
- https://github.com/mozilla-mobile/fenix/pull/11859
|
||||
notification_emails:
|
||||
- fenix-core@mozilla.com
|
||||
- erichards@mozilla.com
|
||||
expires: "2021-03-01"
|
||||
|
|
|
@ -739,7 +739,7 @@ abstract class BaseBrowserFragment : Fragment(), UserInteractionHandler, Session
|
|||
}
|
||||
|
||||
@CallSuper
|
||||
final override fun onPause() {
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
if (findNavController().currentDestination?.id != R.id.searchFragment) {
|
||||
view?.hideKeyboard()
|
||||
|
|
|
@ -17,6 +17,7 @@ import org.mozilla.fenix.GleanMetrics.ErrorPage
|
|||
import org.mozilla.fenix.GleanMetrics.Events
|
||||
import org.mozilla.fenix.GleanMetrics.Logins
|
||||
import org.mozilla.fenix.GleanMetrics.Onboarding
|
||||
import org.mozilla.fenix.GleanMetrics.ProgressiveWebApp
|
||||
import org.mozilla.fenix.GleanMetrics.SearchShortcuts
|
||||
import org.mozilla.fenix.GleanMetrics.Tip
|
||||
import org.mozilla.fenix.GleanMetrics.ToolbarSettings
|
||||
|
@ -185,7 +186,21 @@ sealed class Event {
|
|||
object TabsTrayShareAllTabsPressed : Event()
|
||||
object TabsTrayCloseAllTabsPressed : Event()
|
||||
|
||||
object ProgressiveWebAppOpenFromHomescreenTap : Event()
|
||||
object ProgressiveWebAppInstallAsShortcut : Event()
|
||||
|
||||
// Interaction events with extras
|
||||
|
||||
data class ProgressiveWebAppForeground(val timeForegrounded: Long) : Event() {
|
||||
override val extras: Map<ProgressiveWebApp.foregroundKeys, String>?
|
||||
get() = mapOf(ProgressiveWebApp.foregroundKeys.timeMs to timeForegrounded.toString())
|
||||
}
|
||||
|
||||
data class ProgressiveWebAppBackground(val timeBackgrounded: Long) : Event() {
|
||||
override val extras: Map<ProgressiveWebApp.backgroundKeys, String>?
|
||||
get() = mapOf(ProgressiveWebApp.backgroundKeys.timeMs to timeBackgrounded.toString())
|
||||
}
|
||||
|
||||
data class OnboardingToolbarPosition(val position: Position) : Event() {
|
||||
enum class Position { TOP, BOTTOM }
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@ import org.mozilla.fenix.GleanMetrics.Pocket
|
|||
import org.mozilla.fenix.GleanMetrics.Preferences
|
||||
import org.mozilla.fenix.GleanMetrics.PrivateBrowsingMode
|
||||
import org.mozilla.fenix.GleanMetrics.PrivateBrowsingShortcut
|
||||
import org.mozilla.fenix.GleanMetrics.ProgressiveWebApp
|
||||
import org.mozilla.fenix.GleanMetrics.QrScanner
|
||||
import org.mozilla.fenix.GleanMetrics.ReaderMode
|
||||
import org.mozilla.fenix.GleanMetrics.SearchDefaultEngine
|
||||
|
@ -677,6 +678,20 @@ private val Event.wrapper: EventWrapper<*>?
|
|||
{ Autoplay.settingChanged.record(it) },
|
||||
{ Autoplay.settingChangedKeys.valueOf(it) }
|
||||
)
|
||||
is Event.ProgressiveWebAppOpenFromHomescreenTap -> EventWrapper<NoExtraKeys>(
|
||||
{ ProgressiveWebApp.homescreenTap.record(it) }
|
||||
)
|
||||
is Event.ProgressiveWebAppInstallAsShortcut -> EventWrapper<NoExtraKeys>(
|
||||
{ ProgressiveWebApp.installTap.record(it) }
|
||||
)
|
||||
is Event.ProgressiveWebAppForeground -> EventWrapper(
|
||||
{ ProgressiveWebApp.foreground.record(it) },
|
||||
{ ProgressiveWebApp.foregroundKeys.valueOf(it) }
|
||||
)
|
||||
is Event.ProgressiveWebAppBackground -> EventWrapper(
|
||||
{ ProgressiveWebApp.background.record(it) },
|
||||
{ ProgressiveWebApp.backgroundKeys.valueOf(it) }
|
||||
)
|
||||
|
||||
// Don't record other events in Glean:
|
||||
is Event.AddBookmark -> null
|
||||
|
|
|
@ -20,6 +20,7 @@ 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.feature.pwa.ProgressiveWebAppFacts
|
||||
import mozilla.components.support.base.Component
|
||||
import mozilla.components.support.base.facts.Action
|
||||
import mozilla.components.support.base.facts.Fact
|
||||
|
@ -222,6 +223,12 @@ internal class ReleaseMetricController(
|
|||
}
|
||||
null
|
||||
}
|
||||
Component.FEATURE_PWA to ProgressiveWebAppFacts.Items.HOMESCREEN_ICON_TAP -> {
|
||||
Event.ProgressiveWebAppOpenFromHomescreenTap
|
||||
}
|
||||
Component.FEATURE_PWA to ProgressiveWebAppFacts.Items.INSTALL_SHORTCUT -> {
|
||||
Event.ProgressiveWebAppInstallAsShortcut
|
||||
}
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ package org.mozilla.fenix.customtabs
|
|||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.SystemClock
|
||||
import android.view.View
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.navigation.fragment.navArgs
|
||||
|
@ -30,7 +31,9 @@ import org.mozilla.fenix.R
|
|||
import org.mozilla.fenix.browser.BaseBrowserFragment
|
||||
import org.mozilla.fenix.browser.CustomTabContextMenuCandidate
|
||||
import org.mozilla.fenix.browser.FenixSnackbarDelegate
|
||||
import org.mozilla.fenix.components.metrics.Event
|
||||
import org.mozilla.fenix.ext.components
|
||||
import org.mozilla.fenix.ext.metrics
|
||||
import org.mozilla.fenix.ext.nav
|
||||
import org.mozilla.fenix.ext.requireComponents
|
||||
import org.mozilla.fenix.ext.settings
|
||||
|
@ -150,6 +153,22 @@ class ExternalAppBrowserFragment : BaseBrowserFragment(), UserInteractionHandler
|
|||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
val currTimeMs = SystemClock.elapsedRealtimeNanos() / MS_PRECISION
|
||||
requireComponents.analytics.metrics.track(
|
||||
Event.ProgressiveWebAppForeground(currTimeMs)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
val currTimeMs = SystemClock.elapsedRealtimeNanos() / MS_PRECISION
|
||||
requireComponents.analytics.metrics.track(
|
||||
Event.ProgressiveWebAppBackground(currTimeMs)
|
||||
)
|
||||
}
|
||||
|
||||
override fun removeSessionIfNeeded(): Boolean {
|
||||
return customTabsIntegration.onBackPressed() || super.removeSessionIfNeeded()
|
||||
}
|
||||
|
@ -192,4 +211,9 @@ class ExternalAppBrowserFragment : BaseBrowserFragment(), UserInteractionHandler
|
|||
view,
|
||||
FenixSnackbarDelegate(view)
|
||||
)
|
||||
|
||||
companion object {
|
||||
// We only care about millisecond precision for telemetry events
|
||||
internal const val MS_PRECISION = 1_000_000L
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,9 @@ class PwaOnboardingDialogFragment : DialogFragment() {
|
|||
add_button.setOnClickListener {
|
||||
viewLifecycleOwner.lifecycleScope.launch {
|
||||
components.useCases.webAppUseCases.addToHomescreen()
|
||||
}.invokeOnCompletion { dismiss() }
|
||||
}.invokeOnCompletion {
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -159,6 +159,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-10-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-10-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-10-01 | |
|
||||
| progressive_web_app.background |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user puts the PWA into the background. |[1](https://github.com/mozilla-mobile/fenix/pull/11859)|<ul><li>time_ms: The current time in ms when the PWA was backgrounded. </li></ul>|2021-03-01 | |
|
||||
| progressive_web_app.foreground |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user brings the PWA into the foreground. |[1](https://github.com/mozilla-mobile/fenix/pull/11859)|<ul><li>time_ms: The current time in ms when the PWA was brought to the foreground. </li></ul>|2021-03-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/pull/11859)||2021-03-01 | |
|
||||
| progressive_web_app.install_tap |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user installs a PWA. Could be a shortcut or added to homescreen. |[1](https://github.com/mozilla-mobile/fenix/pull/11859)||2021-03-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-10-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-10-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-10-01 | |
|
||||
|
|
Loading…
Reference in New Issue