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

Commit

Permalink
For #5586 - Adds Logins Telemetry
Browse files Browse the repository at this point in the history
  • Loading branch information
ekager committed Oct 30, 2019
1 parent 05e871d commit ddf0eb3
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 1 deletion.
46 changes: 46 additions & 0 deletions app/metrics.yaml
Expand Up @@ -1509,6 +1509,52 @@ media_notification:
- fenix-core@mozilla.com
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:
- TBD
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:
- TBD
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:
- TBD
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:
- TBD
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"

experiments.metrics:
active_experiment:
type: string
Expand Down
Expand Up @@ -25,6 +25,7 @@ import org.mozilla.fenix.GleanMetrics.Events
import org.mozilla.fenix.GleanMetrics.FindInPage
import org.mozilla.fenix.GleanMetrics.History
import org.mozilla.fenix.GleanMetrics.Library
import org.mozilla.fenix.GleanMetrics.Logins
import org.mozilla.fenix.GleanMetrics.MediaNotification
import org.mozilla.fenix.GleanMetrics.Metrics
import org.mozilla.fenix.GleanMetrics.Pings
Expand Down Expand Up @@ -420,6 +421,18 @@ private val Event.wrapper: EventWrapper<*>?
{ Events.openedLink.record(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:
is Event.AddBookmark -> null
is Event.OpenedBookmark -> null
Expand Down
Expand Up @@ -126,6 +126,10 @@ sealed class Event {
object TrackingProtectionSettingsPanel : Event()
object TrackingProtectionSettings : Event()
object TrackingProtectionException : Event()
object OpenLogins : Event()
object OpenOneLogin : Event()
object CopyLogin : Event()
object ViewLoginPassword : Event()

// Interaction events with extras

Expand Down
Expand Up @@ -13,6 +13,7 @@ import com.google.android.material.snackbar.Snackbar
import kotlinx.android.synthetic.main.fragment_saved_login_site_info.*
import org.mozilla.fenix.R
import org.mozilla.fenix.components.FenixSnackbar
import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.ext.components

class SavedLoginSiteInfoFragment : Fragment(R.layout.fragment_saved_login_site_info) {
Expand Down Expand Up @@ -51,6 +52,7 @@ class SavedLoginSiteInfoFragment : Fragment(R.layout.fragment_saved_login_site_i
val clipboard = view.context.components.clipboardHandler
clipboard.text = savedLoginItem.password
showCopiedSnackbar(getString(R.string.logins_password_copied))
context?.components?.analytics?.metrics?.track(Event.CopyLogin)
}
}

Expand All @@ -62,6 +64,7 @@ class SavedLoginSiteInfoFragment : Fragment(R.layout.fragment_saved_login_site_i

private fun togglePasswordReveal() {
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))
passwordInfoText.inputType = InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD
revealPasswordItem.contentDescription =
Expand Down
Expand Up @@ -22,6 +22,7 @@ import kotlinx.coroutines.launch
import mozilla.components.lib.state.ext.consumeFrom
import org.mozilla.fenix.R
import org.mozilla.fenix.components.StoreProvider
import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.ext.components

class SavedLoginsFragment : Fragment() {
Expand Down Expand Up @@ -64,6 +65,7 @@ class SavedLoginsFragment : Fragment() {
}

private fun itemClicked(item: SavedLoginsItem) {
context?.components?.analytics?.metrics?.track(Event.OpenOneLogin)
val directions =
SavedLoginsFragmentDirections.actionSavedLoginsFragmentToSavedLoginSiteInfoFragment(item)
findNavController().navigate(directions)
Expand Down
Expand Up @@ -15,6 +15,8 @@ import mozilla.components.concept.sync.OAuthAccount
import mozilla.components.service.fxa.SyncEngine
import mozilla.components.service.fxa.manager.SyncEnginesStorage
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.requireComponents

Expand Down Expand Up @@ -93,6 +95,7 @@ class LoginsFragment : PreferenceFragmentCompat(), AccountObserver {
}

private fun navigateToLoginsSettingsFragment() {
context?.components?.analytics?.metrics?.track(Event.OpenLogins)
val directions = LoginsFragmentDirections.actionLoginsFragmentToSavedLoginsFragment()
findNavController().navigate(directions)
}
Expand Down
6 changes: 5 additions & 1 deletion docs/metrics.md
Expand Up @@ -94,6 +94,10 @@ The following metrics are added to the ping:
| library.closed |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user closed the library |[1](https://github.com/mozilla-mobile/fenix/pull/2538#issuecomment-492830242)||2020-03-01 |
| library.opened |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user opened the library |[1](https://github.com/mozilla-mobile/fenix/pull/2538#issuecomment-492830242)||2020-03-01 |
| library.selected_item |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user selected a library item |[1](https://github.com/mozilla-mobile/fenix/pull/2538#issuecomment-492830242)|<ul><li>item: The library item the user selected</li></ul>|2020-03-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](TBD)||2020-03-01 |
| logins.open_individual_logins |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user accessed an individual login in saved logins |[1](TBD)||2020-03-01 |
| logins.open_logins |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user accessed Logins in Settings |[1](TBD)||2020-03-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](TBD)||2020-03-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-03-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-03-01 |
| private_browsing_mode.garbage_icon |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user pressed the garbage can icon on the private browsing home page, deleting all private tabs. |[1](https://github.com/mozilla-mobile/fenix/pull/4968)||2020-03-01 |
Expand Down Expand Up @@ -161,7 +165,7 @@ The following metrics are added to the ping:
| metrics.default_moz_browser |[string](https://mozilla.github.io/glean/book/user/metrics/string.html) |The name of the default browser on device if and only if it's a Mozilla owned product |[1](https://github.com/mozilla-mobile/fenix/pull/1953/), [2](https://github.com/mozilla-mobile/fenix/pull/5216)||2020-03-01 |
| metrics.mozilla_products |[string_list](https://mozilla.github.io/glean/book/user/metrics/string_list.html) |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 Lockwise. |[1](https://github.com/mozilla-mobile/fenix/pull/1953/), [2](https://github.com/mozilla-mobile/fenix/pull/5216)||2020-03-01 |
| metrics.search_count |[labeled_counter](https://mozilla.github.io/glean/book/user/metrics/labeled_counters.html) |The labels for this counter are `<search-engine-name>.<source>`. If the search engine is bundled with Fenix `search-engine-name` will be the name of the search engine. If it's a custom search engine (defined: https://github.com/mozilla-mobile/fenix/issues/1607) the value will be `custom`. `source` will either be `action` or `suggestion` |[1](https://github.com/mozilla-mobile/fenix/pull/1677), [2](https://github.com/mozilla-mobile/fenix/pull/5216)||2020-03-01 |
| metrics.total_uri_count |[counter](https://mozilla.github.io/glean/book/user/metrics/counter.html) |A counter of URIs visited by the user in the current session, including page reloads. This does not include background page requests and URIs from embedded pages or private browsing. |[1](https://github.com/mozilla-mobile/fenix/pull/TODO)||2020-03-01 |
| metrics.total_uri_count |[string](https://mozilla.github.io/glean/book/user/metrics/string.html) |A counter of URIs visited by the user in the current session, including page reloads. This does not include background page requests and URIs from embedded pages or private browsing. |[1](https://github.com/mozilla-mobile/fenix/pull/TODO)||2020-03-01 |
| search.default_engine.code |[string](https://mozilla.github.io/glean/book/user/metrics/string.html) |If the search engine is pre-loaded with Fenix this value will be the search engine identifier. If it's a custom search engine (defined: https://github.com/mozilla-mobile/fenix/issues/1607) the value will be "custom" |[1](https://github.com/mozilla-mobile/fenix/pull/1606), [2](https://github.com/mozilla-mobile/fenix/pull/5216)||2020-03-01 |
| search.default_engine.name |[string](https://mozilla.github.io/glean/book/user/metrics/string.html) |If the search engine is pre-loaded with Fenix this value will be the search engine name. If it's a custom search engine (defined: https://github.com/mozilla-mobile/fenix/issues/1607) the value will be "custom" |[1](https://github.com/mozilla-mobile/fenix/pull/1606), [2](https://github.com/mozilla-mobile/fenix/pull/5216)||2020-03-01 |
| search.default_engine.submission_url |[string](https://mozilla.github.io/glean/book/user/metrics/string.html) |If the search engine is pre-loaded with Fenix this value will be he base URL we use to build the search query for the search engine. For example: https://mysearchengine.com/?query=%s. If it's a custom search engine (defined: https://github.com/mozilla-mobile/fenix/issues/1607) the value will be "custom" |[1](https://github.com/mozilla-mobile/fenix/pull/1606), [2](https://github.com/mozilla-mobile/fenix/pull/5216)||2020-03-01 |
Expand Down

0 comments on commit ddf0eb3

Please sign in to comment.