1
0
Fork 0

For #5586 - Adds Logins Telemetry (#6352)

* For #5586 - Adds Logins Telemetry

* Adds Logins Sync Telemetry to PreferenceToggled event
master
Emily Kager 2019-11-12 15:55:36 -08:00 committed by Jeff Boek
parent f6a66562dd
commit cc318021cc
7 changed files with 86 additions and 7 deletions

View File

@ -108,23 +108,26 @@ events:
preference_toggled: preference_toggled:
type: event type: event
description: > description: >
A user toggled a preference switch in settings A user toggled a boolean preference in settings
extra_keys: extra_keys:
preference_key: preference_key:
description: "The preference key for the switch preference the user toggled. We currently track: description: "The preference key for the boolean (true/false) preference the user toggled. We currently track:
show_search_suggestions, remote_debugging, telemetry, tracking_protection, search_bookmarks, show_search_suggestions, remote_debugging, telemetry, tracking_protection, search_bookmarks,
search_browsing_history, show_clipboard_suggestions, show_search_shortcuts, and open_links_in_a_private_tab" search_browsing_history, show_clipboard_suggestions, show_search_shortcuts, open_links_in_a_private_tab,
and pref_key_sync_logins"
enabled: enabled:
description: "Whether or not the preference is *now* enabled" description: "Whether or not the preference is *now* enabled"
bugs: bugs:
- https://github.com/mozilla-mobile/fenix/issue/975 - https://github.com/mozilla-mobile/fenix/issue/975
- https://github.com/mozilla-mobile/fenix/issue/5094 - https://github.com/mozilla-mobile/fenix/issue/5094
- https://github.com/mozilla-mobile/fenix/issues/5737 - https://github.com/mozilla-mobile/fenix/issues/5737
- https://github.com/mozilla-mobile/fenix/issues/5586
data_reviews: data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/1896 - https://github.com/mozilla-mobile/fenix/pull/1896
- https://github.com/mozilla-mobile/fenix/pull/5704 - https://github.com/mozilla-mobile/fenix/pull/5704
- https://github.com/mozilla-mobile/fenix/pull/5886 - https://github.com/mozilla-mobile/fenix/pull/5886
- https://github.com/mozilla-mobile/fenix/pull/5975 - https://github.com/mozilla-mobile/fenix/pull/5975
- https://github.com/mozilla-mobile/fenix/pull/6352
notification_emails: notification_emails:
- fenix-core@mozilla.com - fenix-core@mozilla.com
expires: "2020-03-01" expires: "2020-03-01"
@ -1443,6 +1446,52 @@ media_notification:
- fenix-core@mozilla.com - fenix-core@mozilla.com
expires: "2020-03-01" expires: "2020-03-01"
logins:
open_logins:
type: event
description: >
A user accessed Logins in Settings
bugs:
- https://github.com/mozilla-mobile/fenix/issues/5586
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/6352
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"
open_individual_login:
type: event
description: >
A user accessed an individual login in saved logins
bugs:
- https://github.com/mozilla-mobile/fenix/issues/5586
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/6352
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"
copy_login:
type: event
description: >
A user copied a piece of a login in saved logins
bugs:
- https://github.com/mozilla-mobile/fenix/issues/5586
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/6352
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"
view_password_login:
type: event
description: >
A user viewed a password in an individual saved login
bugs:
- https://github.com/mozilla-mobile/fenix/issues/5586
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/6352
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"
experiments.metrics: experiments.metrics:
active_experiment: active_experiment:
type: string type: string

View File

@ -25,6 +25,7 @@ import org.mozilla.fenix.GleanMetrics.Events
import org.mozilla.fenix.GleanMetrics.FindInPage import org.mozilla.fenix.GleanMetrics.FindInPage
import org.mozilla.fenix.GleanMetrics.History import org.mozilla.fenix.GleanMetrics.History
import org.mozilla.fenix.GleanMetrics.Library import org.mozilla.fenix.GleanMetrics.Library
import org.mozilla.fenix.GleanMetrics.Logins
import org.mozilla.fenix.GleanMetrics.MediaNotification import org.mozilla.fenix.GleanMetrics.MediaNotification
import org.mozilla.fenix.GleanMetrics.Metrics import org.mozilla.fenix.GleanMetrics.Metrics
import org.mozilla.fenix.GleanMetrics.Pings import org.mozilla.fenix.GleanMetrics.Pings
@ -401,6 +402,18 @@ private val Event.wrapper: EventWrapper<*>?
{ Events.openedLink.record(it) }, { Events.openedLink.record(it) },
{ Events.openedLinkKeys.valueOf(it) } { Events.openedLinkKeys.valueOf(it) }
) )
is Event.OpenLogins -> EventWrapper<NoExtraKeys>(
{ Logins.openLogins.record(it) }
)
is Event.OpenOneLogin -> EventWrapper<NoExtraKeys>(
{ Logins.openIndividualLogin.record(it) }
)
is Event.CopyLogin -> EventWrapper<NoExtraKeys>(
{ Logins.copyLogin.record(it) }
)
is Event.ViewLoginPassword -> EventWrapper<NoExtraKeys>(
{ Logins.viewPasswordLogin.record(it) }
)
// Don't record other events in Glean: // Don't record other events in Glean:
is Event.AddBookmark -> null is Event.AddBookmark -> null
is Event.OpenedBookmark -> null is Event.OpenedBookmark -> null

View File

@ -120,11 +120,15 @@ sealed class Event {
object TrackingProtectionSettingsPanel : Event() object TrackingProtectionSettingsPanel : Event()
object TrackingProtectionSettings : Event() object TrackingProtectionSettings : Event()
object TrackingProtectionException : Event() object TrackingProtectionException : Event()
object OpenLogins : Event()
object OpenOneLogin : Event()
object CopyLogin : Event()
object ViewLoginPassword : Event()
// Interaction events with extras // Interaction events with extras
data class PreferenceToggled(val preferenceKey: String, val enabled: Boolean, val context: Context) : Event() { data class PreferenceToggled(val preferenceKey: String, val enabled: Boolean, val context: Context) : Event() {
private val switchPreferenceTelemetryAllowList = listOf( private val booleanPreferenceTelemetryAllowList = listOf(
context.getString(R.string.pref_key_show_search_suggestions), context.getString(R.string.pref_key_show_search_suggestions),
context.getString(R.string.pref_key_remote_debugging), context.getString(R.string.pref_key_remote_debugging),
context.getString(R.string.pref_key_telemetry), context.getString(R.string.pref_key_telemetry),
@ -133,7 +137,8 @@ sealed class Event {
context.getString(R.string.pref_key_search_browsing_history), context.getString(R.string.pref_key_search_browsing_history),
context.getString(R.string.pref_key_show_clipboard_suggestions), context.getString(R.string.pref_key_show_clipboard_suggestions),
context.getString(R.string.pref_key_show_search_shortcuts), context.getString(R.string.pref_key_show_search_shortcuts),
context.getString(R.string.pref_key_open_links_in_a_private_tab) context.getString(R.string.pref_key_open_links_in_a_private_tab),
context.getString(R.string.pref_key_sync_logins)
) )
override val extras: Map<Events.preferenceToggledKeys, String>? override val extras: Map<Events.preferenceToggledKeys, String>?
@ -144,7 +149,7 @@ sealed class Event {
init { init {
// If the event is not in the allow list, we don't want to track it // If the event is not in the allow list, we don't want to track it
if (!switchPreferenceTelemetryAllowList.contains(preferenceKey)) { throw IllegalArgumentException() } require(booleanPreferenceTelemetryAllowList.contains(preferenceKey))
} }
} }

View File

@ -14,6 +14,7 @@ import com.google.android.material.snackbar.Snackbar
import kotlinx.android.synthetic.main.fragment_saved_login_site_info.* import kotlinx.android.synthetic.main.fragment_saved_login_site_info.*
import org.mozilla.fenix.R import org.mozilla.fenix.R
import org.mozilla.fenix.components.FenixSnackbar import org.mozilla.fenix.components.FenixSnackbar
import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.ext.components import org.mozilla.fenix.ext.components
class SavedLoginSiteInfoFragment : Fragment(R.layout.fragment_saved_login_site_info) { class SavedLoginSiteInfoFragment : Fragment(R.layout.fragment_saved_login_site_info) {
@ -58,6 +59,7 @@ class SavedLoginSiteInfoFragment : Fragment(R.layout.fragment_saved_login_site_i
val clipboard = view.context.components.clipboardHandler val clipboard = view.context.components.clipboardHandler
clipboard.text = savedLoginItem.password clipboard.text = savedLoginItem.password
showCopiedSnackbar(getString(R.string.logins_password_copied)) showCopiedSnackbar(getString(R.string.logins_password_copied))
context?.components?.analytics?.metrics?.track(Event.CopyLogin)
} }
} }
@ -69,6 +71,7 @@ class SavedLoginSiteInfoFragment : Fragment(R.layout.fragment_saved_login_site_i
private fun togglePasswordReveal() { private fun togglePasswordReveal() {
if (passwordInfoText.inputType == InputType.TYPE_TEXT_VARIATION_PASSWORD or InputType.TYPE_CLASS_TEXT) { if (passwordInfoText.inputType == InputType.TYPE_TEXT_VARIATION_PASSWORD or InputType.TYPE_CLASS_TEXT) {
context?.components?.analytics?.metrics?.track(Event.ViewLoginPassword)
revealPasswordItem.setImageDrawable(context?.getDrawable(R.drawable.ic_password_hide)) revealPasswordItem.setImageDrawable(context?.getDrawable(R.drawable.ic_password_hide))
passwordInfoText.inputType = InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD passwordInfoText.inputType = InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD
revealPasswordItem.contentDescription = revealPasswordItem.contentDescription =

View File

@ -22,6 +22,7 @@ import kotlinx.coroutines.launch
import mozilla.components.lib.state.ext.consumeFrom import mozilla.components.lib.state.ext.consumeFrom
import org.mozilla.fenix.R import org.mozilla.fenix.R
import org.mozilla.fenix.components.StoreProvider import org.mozilla.fenix.components.StoreProvider
import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.ext.components import org.mozilla.fenix.ext.components
class SavedLoginsFragment : Fragment() { class SavedLoginsFragment : Fragment() {
@ -70,6 +71,7 @@ class SavedLoginsFragment : Fragment() {
} }
private fun itemClicked(item: SavedLoginsItem) { private fun itemClicked(item: SavedLoginsItem) {
context?.components?.analytics?.metrics?.track(Event.OpenOneLogin)
val directions = val directions =
SavedLoginsFragmentDirections.actionSavedLoginsFragmentToSavedLoginSiteInfoFragment(item) SavedLoginsFragmentDirections.actionSavedLoginsFragmentToSavedLoginSiteInfoFragment(item)
findNavController().navigate(directions) findNavController().navigate(directions)

View File

@ -29,6 +29,8 @@ import mozilla.components.concept.sync.OAuthAccount
import mozilla.components.service.fxa.SyncEngine import mozilla.components.service.fxa.SyncEngine
import mozilla.components.service.fxa.manager.SyncEnginesStorage import mozilla.components.service.fxa.manager.SyncEnginesStorage
import org.mozilla.fenix.R import org.mozilla.fenix.R
import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.getPreferenceKey import org.mozilla.fenix.ext.getPreferenceKey
import org.mozilla.fenix.ext.requireComponents import org.mozilla.fenix.ext.requireComponents
import org.mozilla.fenix.ext.settings import org.mozilla.fenix.ext.settings
@ -234,6 +236,7 @@ class LoginsFragment : PreferenceFragmentCompat(), AccountObserver {
} }
private fun navigateToSavedLoginsFragment() { private fun navigateToSavedLoginsFragment() {
context?.components?.analytics?.metrics?.track(Event.OpenLogins)
val directions = LoginsFragmentDirections.actionLoginsFragmentToSavedLoginsFragment() val directions = LoginsFragmentDirections.actionLoginsFragmentToSavedLoginsFragment()
findNavController().navigate(directions) findNavController().navigate(directions)
} }

File diff suppressed because one or more lines are too long