1
0
Fork 0

For #1190: Adds additional telemetry for FxA login

master
Sawyer Blatz 2019-05-24 08:25:00 -07:00
parent 62bed0cd06
commit 9aa4f48e77
6 changed files with 99 additions and 66 deletions

View File

@ -138,31 +138,31 @@ events:
expires: "2020-03-01"
crash_reporter:
opened:
type: event
description: >
The crash reporter was displayed
bugs:
- 1040
data_reviews:
- TBD
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"
closed:
type: event
description: >
The crash reporter was closed
extra_keys:
crash_submitted:
description: "A boolean that tells us whether or not the user submitted a crash report"
bugs:
- 1040
data_reviews:
- TBD
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"
opened:
type: event
description: >
The crash reporter was displayed
bugs:
- 1040
data_reviews:
- TBD
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"
closed:
type: event
description: >
The crash reporter was closed
extra_keys:
crash_submitted:
description: "A boolean that tells us whether or not the user submitted a crash report"
bugs:
- 1040
data_reviews:
- TBD
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"
context_menu:
item_tapped:
@ -345,9 +345,9 @@ metrics:
mozilla_products:
type: string_list
description: >
A list of all the Mozilla products installed on device. We currently scan for: Firefox, Firefox Beta,
Firefox Aurora, Firefox Nightly, Firefox Fdroid, Firefox Lite, Reference Browser, Reference Browser Debug,
Fenix, Focus, and Lockbox.
A list of all the Mozilla products installed on device. We currently scan for: Firefox, Firefox Beta,
Firefox Aurora, Firefox Nightly, Firefox Fdroid, Firefox Lite, Reference Browser, Reference Browser Debug,
Fenix, Focus, and Lockbox.
send_in_pings:
- metrics
bugs:
@ -746,11 +746,11 @@ error_page:
- fenix-core@mozilla.com
expires: "2020-03-01"
sync:
sync_auth:
opened:
type: event
description: >
A user opened the sync page
A user opened the sync authentication page
bugs:
- 1190
data_reviews:
@ -772,7 +772,7 @@ sync:
sign_in:
type: event
description: >
A user pressed the sign in button on the sync page
A user pressed the sign in button on the sync authentication page
bugs:
- 1190
data_reviews:
@ -783,7 +783,7 @@ sync:
scan_pairing:
type: event
description: >
A user pressed the scan pairing button on the sync page
A user pressed the scan pairing button on the sync authentication page
bugs:
- 1190
data_reviews:
@ -794,7 +794,31 @@ sync:
create_account:
type: event
description: >
A user pressed the create account button on the sync page
A user pressed the create account button on the sync authentication page
bugs:
- 1190
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/2745#issuecomment-494918532
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"
sync_account:
opened:
type: event
description: >
A user opened the sync account page
bugs:
- 1190
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/2745#issuecomment-494918532
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"
closed:
type: event
description: >
A user closed the sync account page
bugs:
- 1190
data_reviews:
@ -805,7 +829,7 @@ sync:
sync_now:
type: event
description: >
A user pressed the sync now button on the sync page
A user pressed the sync now button on the sync account page
bugs:
- 1190
data_reviews:
@ -816,7 +840,7 @@ sync:
sign_out:
type: event
description: >
A user pressed the sign out button on the sync page
A user pressed the sign out button on the sync account page
bugs:
- 1190
data_reviews:

View File

@ -26,7 +26,8 @@ import kotlinx.coroutines.runBlocking
import org.mozilla.fenix.GleanMetrics.QrScanner
import org.mozilla.fenix.GleanMetrics.Library
import org.mozilla.fenix.GleanMetrics.ErrorPage
import org.mozilla.fenix.GleanMetrics.Sync
import org.mozilla.fenix.GleanMetrics.SyncAccount
import org.mozilla.fenix.GleanMetrics.SyncAuth
import org.mozilla.fenix.R
import org.mozilla.fenix.ext.getPreferenceKey
import org.mozilla.fenix.utils.Settings
@ -192,26 +193,32 @@ private val Event.wrapper
{ ErrorPage.visitedError },
{ ErrorPage.visitedErrorKeys.valueOf(it) }
)
is Event.SyncOpened -> EventWrapper<NoExtraKeys>(
{ Sync.opened.record(it) }
is Event.SyncAuthOpened -> EventWrapper<NoExtraKeys>(
{ SyncAuth.opened.record(it) }
)
is Event.SyncClosed -> EventWrapper<NoExtraKeys>(
{ Sync.closed.record(it) }
is Event.SyncAuthClosed -> EventWrapper<NoExtraKeys>(
{ SyncAuth.closed.record(it) }
)
is Event.SyncSignIn -> EventWrapper<NoExtraKeys>(
{ Sync.signIn.record(it) }
is Event.SyncAuthSignIn -> EventWrapper<NoExtraKeys>(
{ SyncAuth.signIn.record(it) }
)
is Event.SyncScanPairing -> EventWrapper<NoExtraKeys>(
{ Sync.scanPairing.record(it) }
is Event.SyncAuthScanPairing -> EventWrapper<NoExtraKeys>(
{ SyncAuth.scanPairing.record(it) }
)
is Event.SyncCreateAccount -> EventWrapper<NoExtraKeys>(
{ Sync.createAccount.record(it) }
is Event.SyncAuthCreateAccount -> EventWrapper<NoExtraKeys>(
{ SyncAuth.createAccount.record(it) }
)
is Event.SyncSyncNow -> EventWrapper<NoExtraKeys>(
{ Sync.syncNow.record(it) }
is Event.SyncAccountOpened -> EventWrapper<NoExtraKeys>(
{ SyncAccount.opened.record(it) }
)
is Event.SyncSignOut -> EventWrapper<NoExtraKeys>(
{ Sync.signOut.record(it) }
is Event.SyncAccountClosed -> EventWrapper<NoExtraKeys>(
{ SyncAccount.closed.record(it) }
)
is Event.SyncAccountSyncNow -> EventWrapper<NoExtraKeys>(
{ SyncAccount.syncNow.record(it) }
)
is Event.SyncAccountSignOut -> EventWrapper<NoExtraKeys>(
{ SyncAccount.signOut.record(it) }
)
// Don't track other events with Glean

View File

@ -81,13 +81,15 @@ sealed class Event {
object QRScannerNavigationDenied : Event()
object LibraryOpened : Event()
object LibraryClosed : Event()
object SyncOpened : Event()
object SyncClosed : Event()
object SyncSignIn : Event()
object SyncScanPairing : Event()
object SyncCreateAccount : Event()
object SyncSyncNow : Event()
object SyncSignOut : Event()
object SyncAuthOpened : Event()
object SyncAuthClosed : Event()
object SyncAuthSignIn : Event()
object SyncAuthScanPairing : Event()
object SyncAuthCreateAccount : Event()
object SyncAccountOpened : Event()
object SyncAccountClosed : Event()
object SyncAccountSyncNow : Event()
object SyncAccountSignOut : Event()
data class PreferenceToggled(val preferenceKey: String, val enabled: Boolean, val context: Context) : Event() {
private val switchPreferenceTelemetryAllowList = listOf(

View File

@ -45,11 +45,13 @@ class AccountSettingsFragment : PreferenceFragmentCompat(), CoroutineScope {
job = Job()
(activity as AppCompatActivity).title = getString(R.string.preferences_account_settings)
(activity as AppCompatActivity).supportActionBar?.show()
requireComponents.analytics.metrics.track(Event.SyncAccountOpened)
}
override fun onDestroy() {
super.onDestroy()
job.cancel()
requireComponents.analytics.metrics.track(Event.SyncAccountClosed)
}
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
@ -97,7 +99,7 @@ class AccountSettingsFragment : PreferenceFragmentCompat(), CoroutineScope {
private fun getClickListenerForSignOut(): Preference.OnPreferenceClickListener {
return Preference.OnPreferenceClickListener {
requireComponents.analytics.metrics.track(Event.SyncSignOut)
requireComponents.analytics.metrics.track(Event.SyncAccountSignOut)
launch {
accountManager.logoutAsync().await()
Navigation.findNavController(view!!).popBackStack()
@ -109,7 +111,7 @@ class AccountSettingsFragment : PreferenceFragmentCompat(), CoroutineScope {
private fun getClickListenerForSyncNow(): Preference.OnPreferenceClickListener {
return Preference.OnPreferenceClickListener {
// Trigger a sync.
requireComponents.analytics.metrics.track(Event.SyncSyncNow)
requireComponents.analytics.metrics.track(Event.SyncAccountSyncNow)
requireComponents.backgroundServices.syncManager.syncNow()
// Poll for device events.
launch {
@ -183,7 +185,6 @@ class AccountSettingsFragment : PreferenceFragmentCompat(), CoroutineScope {
}
}
private val deviceConstellationObserver = object : DeviceConstellationObserver {
override fun onDevicesUpdate(constellation: ConstellationState) {
val deviceNameKey = context!!.getPreferenceKey(R.string.pref_key_sync_device_name)

View File

@ -203,7 +203,6 @@ class SettingsFragment : PreferenceFragmentCompat(), CoroutineScope, AccountObse
private fun getClickListenerForSignIn(): OnPreferenceClickListener {
return OnPreferenceClickListener {
requireComponents.analytics.metrics.track(Event.SyncOpened)
val directions = SettingsFragmentDirections.actionSettingsFragmentToTurnOnSyncFragment()
Navigation.findNavController(view!!).navigate(directions)
true

View File

@ -20,12 +20,12 @@ class TurnOnSyncFragment : PreferenceFragmentCompat() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
requireComponents.analytics.metrics.track(Event.SyncOpened)
requireComponents.analytics.metrics.track(Event.SyncAuthOpened)
}
override fun onDestroy() {
super.onDestroy()
requireComponents.analytics.metrics.track(Event.SyncClosed)
requireComponents.analytics.metrics.track(Event.SyncAuthClosed)
}
override fun onResume() {
@ -56,7 +56,7 @@ class TurnOnSyncFragment : PreferenceFragmentCompat() {
// session history stack.
// We could auto-close this tab once we get to the end of the authentication process?
// Via an interceptor, perhaps.
requireComponents.analytics.metrics.track(Event.SyncSignIn)
requireComponents.analytics.metrics.track(Event.SyncAuthSignIn)
view?.let {
(activity as HomeActivity).openToBrowser(BrowserDirection.FromTurnOnSync)
}
@ -68,7 +68,7 @@ class TurnOnSyncFragment : PreferenceFragmentCompat() {
// Currently the same as sign in, as FxA handles this, however we want to emit a different telemetry event
return Preference.OnPreferenceClickListener {
requireComponents.services.accountsAuthFeature.beginAuthentication()
requireComponents.analytics.metrics.track(Event.SyncCreateAccount)
requireComponents.analytics.metrics.track(Event.SyncAuthCreateAccount)
view?.let {
(activity as HomeActivity).openToBrowser(BrowserDirection.FromTurnOnSync)
}
@ -80,7 +80,7 @@ class TurnOnSyncFragment : PreferenceFragmentCompat() {
return Preference.OnPreferenceClickListener {
val directions = TurnOnSyncFragmentDirections.actionTurnOnSyncFragmentToPairInstructionsFragment()
Navigation.findNavController(view!!).navigate(directions)
requireComponents.analytics.metrics.track(Event.SyncScanPairing)
requireComponents.analytics.metrics.track(Event.SyncAuthScanPairing)
true
}