Skip to content

Commit

Permalink
For mozilla-mobile#18854: Add metrics for home screen being displayed.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcarare committed Apr 14, 2021
1 parent de2fb6e commit 969ea05
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 1 deletion.
14 changes: 14 additions & 0 deletions app/metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5107,6 +5107,20 @@ home_menu:
- fenix-core@mozilla.com
expires: "2021-10-01"

home_screen:
home_screen_displayed:
type: event
description: The user clicked the settings option in home menu.
bugs:
- https://github.com/mozilla-mobile/fenix/issues/18856
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/19025
data_sensitivity:
- interaction
notification_emails:
- fenix-core@mozilla.com
expires: "2021-10-01"

android_keystore_experiment:
experiment_failure:
type: event
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ sealed class Event {

// Home menu interaction
object HomeMenuSettingsItemClicked : Event()
object HomeScreenDisplayed : Event()

// Interaction events with extras

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import org.mozilla.fenix.GleanMetrics.ErrorPage
import org.mozilla.fenix.GleanMetrics.Events
import org.mozilla.fenix.GleanMetrics.FindInPage
import org.mozilla.fenix.GleanMetrics.History
import org.mozilla.fenix.GleanMetrics.HomeMenu
import org.mozilla.fenix.GleanMetrics.HomeScreen
import org.mozilla.fenix.GleanMetrics.LoginDialog
import org.mozilla.fenix.GleanMetrics.Logins
import org.mozilla.fenix.GleanMetrics.MasterPassword
Expand Down Expand Up @@ -70,6 +70,7 @@ import org.mozilla.fenix.GleanMetrics.VoiceSearch
import org.mozilla.fenix.components.toolbar.ToolbarPosition
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.settings
import org.mozilla.fenix.home.HomeMenu
import org.mozilla.fenix.utils.BrowsersCache
import org.mozilla.fenix.utils.Settings

Expand Down Expand Up @@ -821,6 +822,9 @@ private val Event.wrapper: EventWrapper<*>?
is Event.SetDefaultBrowserClicked -> EventWrapper<NoExtraKeys>(
{ SetDefaultNewtabExperiment.setDefaultBrowserClicked.record(it) }
)
is Event.HomeScreenDisplayed -> EventWrapper<NoExtraKeys>(
{ HomeScreen.homeScreenDisplayed.record(it) }
)

// Don't record other events in Glean:
is Event.AddBookmark -> null
Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ class HomeFragment : Fragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) =
PerfStartup.homeFragmentOnViewCreated.measureNoInline {
super.onViewCreated(view, savedInstanceState)
context?.metrics?.track(Event.HomeScreenDisplayed)

observeSearchEngineChanges()
createHomeMenu(requireContext(), WeakReference(view.menuButton))
Expand Down
1 change: 1 addition & 0 deletions docs/metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ In addition to those built-in metrics, the following metrics are added to the pi
| history.removed_all |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user removed all history items |[mozilla-mobile/fenix#3940](https://github.com/mozilla-mobile/fenix/pull/3940), [mozilla-mobile/fenix#15713](https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068)||2021-08-01 |2 |
| history.shared |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user shared a history item |[mozilla-mobile/fenix#3940](https://github.com/mozilla-mobile/fenix/pull/3940), [mozilla-mobile/fenix#15713](https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068)||2021-08-01 |2 |
| home_menu.settings_item_clicked |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |The user clicked the settings option in home menu. |[mozilla-mobile/fenix#18987](https://github.com/mozilla-mobile/fenix/pull/18987)||2021-10-01 |2 |
| home_screen.home_screen_displayed |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |The user clicked the settings option in home menu. |[mozilla-mobile/fenix#19025](https://github.com/mozilla-mobile/fenix/pull/19025)||2021-10-01 |2 |
| login_dialog.cancelled |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |The login dialog prompt was cancelled |[mozilla-mobile/fenix#13050](https://github.com/mozilla-mobile/fenix/pull/13050)||2021-08-01 |2 |
| login_dialog.displayed |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |The login dialog prompt was displayed |[mozilla-mobile/fenix#13050](https://github.com/mozilla-mobile/fenix/pull/13050)||2021-08-01 |2 |
| login_dialog.never_save |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |The login dialog prompt "never save" button was pressed |[mozilla-mobile/fenix#13050](https://github.com/mozilla-mobile/fenix/pull/13050)||2021-08-01 |2 |
Expand Down

0 comments on commit 969ea05

Please sign in to comment.