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

For #6396 - Added metrics for history/bookmarks account sync #6601

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion app/metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,20 +114,22 @@ events:
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,
search_browsing_history, show_clipboard_suggestions, show_search_shortcuts, open_links_in_a_private_tab,
and pref_key_sync_logins"
pref_key_sync_logins, pref_key_sync_bookmarks and pref_key_sync_history"
enabled:
description: "Whether or not the preference is *now* enabled"
bugs:
- https://github.com/mozilla-mobile/fenix/issues/975
- https://github.com/mozilla-mobile/fenix/issues/5094
- https://github.com/mozilla-mobile/fenix/issues/5737
- https://github.com/mozilla-mobile/fenix/issues/5586
- https://github.com/mozilla-mobile/fenix/issues/6396
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/1896
- https://github.com/mozilla-mobile/fenix/pull/5704
- https://github.com/mozilla-mobile/fenix/pull/5886
- https://github.com/mozilla-mobile/fenix/pull/5975
- https://github.com/mozilla-mobile/fenix/pull/6352
- https://github.com/mozilla-mobile/fenix/pull/6601
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,9 @@ sealed class Event {
context.getString(R.string.pref_key_show_clipboard_suggestions),
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_sync_logins)
context.getString(R.string.pref_key_sync_logins),
context.getString(R.string.pref_key_sync_bookmarks),
context.getString(R.string.pref_key_sync_history)
)

override val extras: Map<Events.preferenceToggledKeys, String>?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,12 @@ class AccountSettingsFragment : PreferenceFragmentCompat() {
val historyNameKey = getPreferenceKey(R.string.pref_key_sync_history)
findPreference<CheckBoxPreference>(historyNameKey)?.apply {
setOnPreferenceChangeListener { _, newValue ->
SyncEnginesStorage(context).setStatus(SyncEngine.History, newValue as Boolean)
requireComponents.analytics.metrics.track(Event.PreferenceToggled(
preferenceKey = historyNameKey,
enabled = newValue as Boolean,
context = context
))
SyncEnginesStorage(context).setStatus(SyncEngine.History, newValue)
@Suppress("DeferredResultUnused")
context.components.backgroundServices.accountManager.syncNowAsync(SyncReason.EngineChange)
true
Expand All @@ -176,7 +181,12 @@ class AccountSettingsFragment : PreferenceFragmentCompat() {
val bookmarksNameKey = getPreferenceKey(R.string.pref_key_sync_bookmarks)
findPreference<CheckBoxPreference>(bookmarksNameKey)?.apply {
setOnPreferenceChangeListener { _, newValue ->
SyncEnginesStorage(context).setStatus(SyncEngine.Bookmarks, newValue as Boolean)
requireComponents.analytics.metrics.track(Event.PreferenceToggled(
preferenceKey = bookmarksNameKey,
enabled = newValue as Boolean,
context = context
))
SyncEnginesStorage(context).setStatus(SyncEngine.Bookmarks, newValue)
@Suppress("DeferredResultUnused")
context.components.backgroundServices.accountManager.syncNowAsync(SyncReason.EngineChange)
true
Expand Down
2 changes: 1 addition & 1 deletion docs/metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,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-03-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-03-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-03-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)|<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, and pref_key_sync_logins</li></ul>|2020-03-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)|<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, pref_key_sync_logins, pref_key_sync_bookmarks and pref_key_sync_history</li></ul>|2020-03-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-03-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)|<ul><li>source: The location from which the user selected the what's new button. Either 'about' or 'home'</li></ul>|2020-03-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-03-01 |
Expand Down