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

Commit

Permalink
For #19915: Add telemetry for the toolbar Home screen button.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcarare committed Jun 10, 2021
1 parent 2ebc71f commit 1a91d20
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 0 deletions.
14 changes: 14 additions & 0 deletions app/metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,20 @@ events:
notification_emails:
- fenix-core@mozilla.com
expires: "2021-05-10"
browser_toolbar_home_tapped:
type: event
description: |
An event that indicates that a user has tapped
home button on browser toolbar.
bugs:
- https://github.com/mozilla-mobile/fenix/issues/19915
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/19936
data_sensitivity:
- interaction
notification_emails:
- fenix-core@mozilla.com
expires: "2021-12-10"

onboarding:
fxa_auto_signin:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,8 @@ sealed class Event {
object HomeMenuSettingsItemClicked : Event()
object HomeScreenDisplayed : Event()

// Browser Toolbar
object BrowserToolbarHomeButtonClicked : Event()
// Interaction events with extras

data class TopSiteSwipeCarousel(val page: Int) : Event() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,10 @@ private val Event.wrapper: EventWrapper<*>?
{ HomeScreen.homeScreenDisplayed.record(it) }
)

is Event.BrowserToolbarHomeButtonClicked -> EventWrapper<NoExtraKeys>(
{ Events.browserToolbarHomeTapped.record(it) }
)

// Don't record other events in Glean:
is Event.AddBookmark -> null
is Event.OpenedAppFirstRun -> null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ class DefaultBrowserToolbarController(
}

override fun handleHomeButtonClick() {
metrics.track(Event.BrowserToolbarHomeButtonClicked)

navController.navigateBlockingForAsyncNavGraph(
BrowserFragmentDirections.actionGlobalHome()
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import org.junit.Assert.assertEquals
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.mozilla.fenix.GleanMetrics.Events
import org.mozilla.fenix.HomeActivity
import org.mozilla.fenix.R
import org.mozilla.fenix.browser.BrowserAnimator
Expand Down Expand Up @@ -318,6 +319,8 @@ class DefaultBrowserToolbarControllerTest {
controller.handleHomeButtonClick()

verify { navController.navigate(BrowserFragmentDirections.actionGlobalHome()) }
verify { metrics.track(Event.BrowserToolbarHomeButtonClicked) }

}

private fun createController(
Expand Down

0 comments on commit 1a91d20

Please sign in to comment.