2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-15 18:12:54 +00:00

[fenix] For https://github.com/mozilla-mobile/fenix/issues/5586 - Add telemetry for save logins setting

This commit is contained in:
ekager 2020-01-16 09:50:27 -08:00 committed by Jeff Boek
parent 421f034e3a
commit 6377a946f8
5 changed files with 63 additions and 6 deletions

View File

@ -114,7 +114,7 @@ events:
description: "The preference key for the boolean (true/false) 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, open_links_in_a_private_tab (bug in implementation https://github.com/mozilla-mobile/fenix/issues/7384), search_browsing_history, show_clipboard_suggestions, show_search_shortcuts, open_links_in_a_private_tab (bug in implementation https://github.com/mozilla-mobile/fenix/issues/7384),
pref_key_sync_logins, pref_key_sync_bookmarks, pref_key_sync_history pref_key_sync_logins, pref_key_sync_bookmarks, pref_key_sync_history,
and pref_key_show_search_suggestions_in_private" and pref_key_show_search_suggestions_in_private"
enabled: enabled:
description: "Whether or not the preference is *now* enabled" description: "Whether or not the preference is *now* enabled"
@ -1537,6 +1537,20 @@ logins:
notification_emails: notification_emails:
- fenix-core@mozilla.com - fenix-core@mozilla.com
expires: "2020-09-01" expires: "2020-09-01"
save_logins_setting_changed:
type: event
description: >
A user changed their setting for asking to save logins
extra_keys:
setting:
description: "The new setting for saving logins the user selected. Either `ask_to_save` or `never_save`"
bugs:
- https://github.com/mozilla-mobile/fenix/issues/5586
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/7767
notification_emails:
- fenix-core@mozilla.com
expires: "2020-09-01"
download_notification: download_notification:
resume: resume:

View File

@ -452,6 +452,10 @@ private val Event.wrapper: EventWrapper<*>?
is Event.CustomEngineDeleted -> EventWrapper<NoExtraKeys>( is Event.CustomEngineDeleted -> EventWrapper<NoExtraKeys>(
{ UserSpecifiedSearchEngines.customEngineDeleted.record(it) } { UserSpecifiedSearchEngines.customEngineDeleted.record(it) }
) )
is Event.SaveLoginsSettingChanged -> EventWrapper(
{ Logins.saveLoginsSettingChanged.record(it) },
{ Logins.saveLoginsSettingChangedKeys.valueOf(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

@ -26,6 +26,7 @@ import org.mozilla.fenix.GleanMetrics.CrashReporter
import org.mozilla.fenix.GleanMetrics.ErrorPage import org.mozilla.fenix.GleanMetrics.ErrorPage
import org.mozilla.fenix.GleanMetrics.Events import org.mozilla.fenix.GleanMetrics.Events
import org.mozilla.fenix.GleanMetrics.Library import org.mozilla.fenix.GleanMetrics.Library
import org.mozilla.fenix.GleanMetrics.Logins
import org.mozilla.fenix.GleanMetrics.SearchShortcuts import org.mozilla.fenix.GleanMetrics.SearchShortcuts
import org.mozilla.fenix.GleanMetrics.ToolbarSettings import org.mozilla.fenix.GleanMetrics.ToolbarSettings
import org.mozilla.fenix.GleanMetrics.TrackingProtection import org.mozilla.fenix.GleanMetrics.TrackingProtection
@ -189,6 +190,13 @@ sealed class Event {
get() = hashMapOf(TrackingProtection.etpSettingChangedKeys.etpSetting to setting.name) get() = hashMapOf(TrackingProtection.etpSettingChangedKeys.etpSetting to setting.name)
} }
data class SaveLoginsSettingChanged(val setting: Setting) : Event() {
enum class Setting { NEVER_SAVE, ASK_TO_SAVE }
override val extras: Map<Logins.saveLoginsSettingChangedKeys, String>?
get() = hashMapOf(Logins.saveLoginsSettingChangedKeys.setting to setting.name)
}
data class OpenedApp(val source: Source) : Event() { data class OpenedApp(val source: Source) : Event() {
enum class Source { APP_ICON, LINK, CUSTOM_TAB } enum class Source { APP_ICON, LINK, CUSTOM_TAB }
override val extras: Map<Events.appOpenedKeys, String>? override val extras: Map<Events.appOpenedKeys, String>?

View File

@ -5,10 +5,14 @@
package org.mozilla.fenix.settings.logins package org.mozilla.fenix.settings.logins
import android.os.Bundle import android.os.Bundle
import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat import androidx.preference.PreferenceFragmentCompat
import org.mozilla.fenix.R import org.mozilla.fenix.R
import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.ext.metrics
import org.mozilla.fenix.ext.showToolbar import org.mozilla.fenix.ext.showToolbar
import org.mozilla.fenix.settings.RadioButtonPreference import org.mozilla.fenix.settings.RadioButtonPreference
import org.mozilla.fenix.settings.SharedPreferenceUpdater
class SaveLoginSettingFragment : PreferenceFragmentCompat() { class SaveLoginSettingFragment : PreferenceFragmentCompat() {
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
@ -24,13 +28,39 @@ class SaveLoginSettingFragment : PreferenceFragmentCompat() {
} }
private fun bindSave(): RadioButtonPreference { private fun bindSave(): RadioButtonPreference {
val keyStrict = getString(R.string.pref_key_save_logins) val keySave = getString(R.string.pref_key_save_logins)
return requireNotNull(findPreference(keyStrict)) val preferenceSave = findPreference<RadioButtonPreference>(keySave)
preferenceSave?.onPreferenceChangeListener = object : SharedPreferenceUpdater() {
override fun onPreferenceChange(preference: Preference, newValue: Any?): Boolean {
if (newValue == true) {
context?.metrics?.track(
Event.SaveLoginsSettingChanged(
Event.SaveLoginsSettingChanged.Setting.ASK_TO_SAVE
)
)
}
return super.onPreferenceChange(preference, newValue)
}
}
return requireNotNull(preferenceSave)
} }
private fun bindNeverSave(): RadioButtonPreference { private fun bindNeverSave(): RadioButtonPreference {
val keyStandard = getString(R.string.pref_key_never_save_logins) val keyNeverSave = getString(R.string.pref_key_never_save_logins)
return requireNotNull(findPreference(keyStandard)) val preferenceNeverSave = findPreference<RadioButtonPreference>(keyNeverSave)
preferenceNeverSave?.onPreferenceChangeListener = object : SharedPreferenceUpdater() {
override fun onPreferenceChange(preference: Preference, newValue: Any?): Boolean {
if (newValue == true) {
context?.metrics?.track(
Event.SaveLoginsSettingChanged(
Event.SaveLoginsSettingChanged.Setting.NEVER_SAVE
)
)
}
return super.onPreferenceChange(preference, newValue)
}
}
return requireNotNull(preferenceNeverSave)
} }
private fun setupRadioGroups( private fun setupRadioGroups(

View File

@ -84,7 +84,7 @@ The following metrics are added to the ping:
| events.entered_url |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user entered a url |[1](https://github.com/mozilla-mobile/fenix/pull/1067#issuecomment-474598673)|<ul><li>autocomplete: A boolean that tells us whether the URL was autofilled by an Autocomplete suggestion</li></ul>|2020-09-01 | | events.entered_url |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user entered a url |[1](https://github.com/mozilla-mobile/fenix/pull/1067#issuecomment-474598673)|<ul><li>autocomplete: A boolean that tells us whether the URL was autofilled by an Autocomplete suggestion</li></ul>|2020-09-01 |
| events.opened_link |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user opened a link with Fenix |[1](https://github.com/mozilla-mobile/fenix/pull/5975)|<ul><li>mode: The mode the link was opened in. Either 'PRIVATE' or 'NORMAL'</li></ul>|2020-09-01 | | events.opened_link |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user opened a link with Fenix |[1](https://github.com/mozilla-mobile/fenix/pull/5975)|<ul><li>mode: The mode the link was opened in. Either 'PRIVATE' or 'NORMAL'</li></ul>|2020-09-01 |
| events.performed_search |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user performed a search |[1](https://github.com/mozilla-mobile/fenix/pull/1067#issuecomment-474598673), [2](https://github.com/mozilla-mobile/fenix/pull/1677)|<ul><li>source: A string that tells us how the user performed the search. Possible values are: * default.action * default.suggestion * shortcut.action * shortcut.suggestion </li></ul>|2020-09-01 | | events.performed_search |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user performed a search |[1](https://github.com/mozilla-mobile/fenix/pull/1067#issuecomment-474598673), [2](https://github.com/mozilla-mobile/fenix/pull/1677)|<ul><li>source: A string that tells us how the user performed the search. Possible values are: * default.action * default.suggestion * shortcut.action * shortcut.suggestion </li></ul>|2020-09-01 |
| events.preference_toggled |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user toggled a boolean preference in settings |[1](https://github.com/mozilla-mobile/fenix/pull/1896), [2](https://github.com/mozilla-mobile/fenix/pull/5704), [3](https://github.com/mozilla-mobile/fenix/pull/5886), [4](https://github.com/mozilla-mobile/fenix/pull/5975), [5](https://github.com/mozilla-mobile/fenix/pull/6352), [6](https://github.com/mozilla-mobile/fenix/pull/6601), [7](https://github.com/mozilla-mobile/fenix/pull/6746)|<ul><li>enabled: Whether or not the preference is *now* enabled</li><li>preference_key: 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, search_browsing_history, show_clipboard_suggestions, show_search_shortcuts, open_links_in_a_private_tab (bug in implementation https://github.com/mozilla-mobile/fenix/issues/7384), pref_key_sync_logins, pref_key_sync_bookmarks, pref_key_sync_history and pref_key_show_search_suggestions_in_private</li></ul>|2020-09-01 | | events.preference_toggled |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user toggled a boolean preference in settings |[1](https://github.com/mozilla-mobile/fenix/pull/1896), [2](https://github.com/mozilla-mobile/fenix/pull/5704), [3](https://github.com/mozilla-mobile/fenix/pull/5886), [4](https://github.com/mozilla-mobile/fenix/pull/5975), [5](https://github.com/mozilla-mobile/fenix/pull/6352), [6](https://github.com/mozilla-mobile/fenix/pull/6601), [7](https://github.com/mozilla-mobile/fenix/pull/6746)|<ul><li>enabled: Whether or not the preference is *now* enabled</li><li>preference_key: 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, search_browsing_history, show_clipboard_suggestions, show_search_shortcuts, open_links_in_a_private_tab (bug in implementation https://github.com/mozilla-mobile/fenix/issues/7384), pref_key_sync_logins, pref_key_sync_bookmarks, pref_key_sync_history, and pref_key_show_search_suggestions_in_private</li></ul>|2020-09-01 |
| events.search_bar_tapped |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user tapped the search bar |[1](https://github.com/mozilla-mobile/fenix/pull/1067#issuecomment-474598673)|<ul><li>source: The view the user was on when they initiated the search (For example: `Home` or `Browser`)</li></ul>|2020-09-01 | | events.search_bar_tapped |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user tapped the search bar |[1](https://github.com/mozilla-mobile/fenix/pull/1067#issuecomment-474598673)|<ul><li>source: The view the user was on when they initiated the search (For example: `Home` or `Browser`)</li></ul>|2020-09-01 |
| events.whats_new_tapped |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user opened the "what's new" page button |[1](https://github.com/mozilla-mobile/fenix/pull/5090)||2020-09-01 | | events.whats_new_tapped |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user opened the "what's new" page button |[1](https://github.com/mozilla-mobile/fenix/pull/5090)||2020-09-01 |
| find_in_page.closed |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user closed the find in page UI |[1](https://github.com/mozilla-mobile/fenix/pull/1344#issuecomment-479285010)||2020-09-01 | | find_in_page.closed |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user closed the find in page UI |[1](https://github.com/mozilla-mobile/fenix/pull/1344#issuecomment-479285010)||2020-09-01 |
@ -101,6 +101,7 @@ The following metrics are added to the ping:
| logins.copy_login |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user copied a piece of a login in saved logins |[1](https://github.com/mozilla-mobile/fenix/pull/6352)||2020-09-01 | | logins.copy_login |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user copied a piece of a login in saved logins |[1](https://github.com/mozilla-mobile/fenix/pull/6352)||2020-09-01 |
| logins.open_individual_login |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user accessed an individual login in saved logins |[1](https://github.com/mozilla-mobile/fenix/pull/6352)||2020-09-01 | | logins.open_individual_login |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user accessed an individual login in saved logins |[1](https://github.com/mozilla-mobile/fenix/pull/6352)||2020-09-01 |
| logins.open_logins |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user accessed Logins in Settings |[1](https://github.com/mozilla-mobile/fenix/pull/6352)||2020-09-01 | | logins.open_logins |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user accessed Logins in Settings |[1](https://github.com/mozilla-mobile/fenix/pull/6352)||2020-09-01 |
| logins.save_logins_setting_changed |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user changed their setting for asking to save logins |[1](https://github.com/mozilla-mobile/fenix/pull/7767)|<ul><li>setting: The new setting for saving logins the user selected. Either `ask_to_save` or `never_save`</li></ul>|2020-09-01 |
| logins.view_password_login |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user viewed a password in an individual saved login |[1](https://github.com/mozilla-mobile/fenix/pull/6352)||2020-09-01 | | logins.view_password_login |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user viewed a password in an individual saved login |[1](https://github.com/mozilla-mobile/fenix/pull/6352)||2020-09-01 |
| media_notification.pause |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user pressed the pause icon on the media notification |[1](https://github.com/mozilla-mobile/fenix/pull/5520)||2020-09-01 | | media_notification.pause |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user pressed the pause icon on the media notification |[1](https://github.com/mozilla-mobile/fenix/pull/5520)||2020-09-01 |
| media_notification.play |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user pressed the play icon on the media notification |[1](https://github.com/mozilla-mobile/fenix/pull/5520)||2020-09-01 | | media_notification.play |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user pressed the play icon on the media notification |[1](https://github.com/mozilla-mobile/fenix/pull/5520)||2020-09-01 |