Skip to content

Commit

Permalink
For mozilla-mobile#18855 [Telemetry] Send an event when users open th…
Browse files Browse the repository at this point in the history
…e toolbar menu
  • Loading branch information
Amejia481 committed Apr 13, 2021
1 parent e40ac27 commit 7af2081
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 2 deletions.
14 changes: 14 additions & 0 deletions app/metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,20 @@ experiments_default_browser:
notification_emails:
- fenix-core@mozilla.com
expires: "2021-10-01"
menu_toolbar_visible:
type: event
description: |
Set default browser menu was displayed from toolbar menu
bugs:
- https://github.com/mozilla-mobile/fenix/issues/18855
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/18895
data_sensitivity:
- interaction
notification_emails:
- fenix-core@mozilla.com
expires: "2021-10-01"

toolbar_settings:
changed_position:
type: event
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ sealed class Event {
object OpenedTabSuggestionClicked : Event()

object SetDefaultBrowserToolbarMenuClicked : Event()

object SetDefaultBrowserToolbarMenuShown : 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 @@ -200,6 +200,9 @@ private val Event.wrapper: EventWrapper<*>?
is Event.SetDefaultBrowserToolbarMenuClicked -> EventWrapper<NoExtraKeys>(
{ ExperimentsDefaultBrowser.toolbarMenuClicked.record(it) }
)
is Event.SetDefaultBrowserToolbarMenuShown -> EventWrapper<NoExtraKeys>(
{ ExperimentsDefaultBrowser.menuToolbarVisible.record(it) }
)
is Event.OpenedBookmark -> EventWrapper<NoExtraKeys>(
{ BookmarksManagement.open.record(it) }
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import org.mozilla.fenix.FeatureFlags.tabsTrayRewrite
import org.mozilla.fenix.HomeActivity
import org.mozilla.fenix.R
import org.mozilla.fenix.browser.browsingmode.BrowsingMode
import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.experiments.ExperimentBranch
import org.mozilla.fenix.experiments.Experiments
import org.mozilla.fenix.ext.asActivity
Expand Down Expand Up @@ -624,13 +625,16 @@ open class DefaultToolbarMenu(
}
}
private fun getSetDefaultBrowserItem(): BrowserMenuImageText? {
val experiments = context.components.analytics.experiments
val analytics = context.components.analytics
val experiments = analytics.experiments
val browsers = BrowsersCache.all(context)

return experiments.withExperiment(Experiments.DEFAULT_BROWSER) { experimentBranch ->
if (experimentBranch == ExperimentBranch.DEFAULT_BROWSER_TOOLBAR_MENU &&
!browsers.isFirefoxDefaultBrowser
) {
analytics.metrics.track(Event.SetDefaultBrowserToolbarMenuShown)

return@withExperiment BrowserMenuImageText(
label = context.getString(R.string.preferences_set_as_default_browser),
imageResource = R.mipmap.ic_launcher
Expand Down
1 change: 1 addition & 0 deletions docs/metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ In addition to those built-in metrics, the following metrics are added to the pi
| events.synced_tab_opened |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |An event that indicates that a synced tab was opened. |[mozilla-mobile/fenix#16727](https://github.com/mozilla-mobile/fenix/pull/16727)||2021-05-10 |2 |
| events.tab_counter_menu_action |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A tab counter menu item was tapped |[mozilla-mobile/fenix#11533](https://github.com/mozilla-mobile/fenix/pull/11533), [mozilla-mobile/fenix#13958](https://github.com/mozilla-mobile/fenix/pull/13958#issuecomment-676857877), [mozilla-mobile/fenix#18143](https://github.com/mozilla-mobile/fenix/pull/18143)|<ul><li>item: A string containing the name of the item the user tapped. These items are: New tab, New private tab, Close tab </li></ul>|2021-07-01 |2 |
| events.whats_new_tapped |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user opened the "what's new" page button |[mozilla-mobile/fenix#5090](https://github.com/mozilla-mobile/fenix/pull/5090), [mozilla-mobile/fenix#13958](https://github.com/mozilla-mobile/fenix/pull/13958#issuecomment-676857877), [mozilla-mobile/fenix#18143](https://github.com/mozilla-mobile/fenix/pull/18143)||2021-07-01 |2 |
| experiments_default_browser.menu_toolbar_visible |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |Set default browser menu was displayed from toolbar menu |[mozilla-mobile/fenix#18895](https://github.com/mozilla-mobile/fenix/pull/18895)||2021-10-01 |2 |
| experiments_default_browser.toolbar_menu_clicked |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |Set default browser was clicked from toolbar menu |[mozilla-mobile/fenix#18895](https://github.com/mozilla-mobile/fenix/pull/18895)||2021-10-01 |2 |
| find_in_page.closed |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user closed the find in page UI |[mozilla-mobile/fenix#1344](https://github.com/mozilla-mobile/fenix/pull/1344#issuecomment-479285010), [mozilla-mobile/fenix#15713](https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068)||2021-08-01 |2 |
| find_in_page.opened |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user opened the find in page UI |[mozilla-mobile/fenix#1344](https://github.com/mozilla-mobile/fenix/pull/1344#issuecomment-479285010), [mozilla-mobile/fenix#15713](https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068)||2021-08-01 |2 |
Expand Down

0 comments on commit 7af2081

Please sign in to comment.