Skip to content

Commit

Permalink
For mozilla-mobile#18857 [Telemetry] Send a Glean event when users ch…
Browse files Browse the repository at this point in the history
…ange their default browser

For mozilla-mobile#18855 [Telemetry] Send an event when users open the toolbar menu

For mozilla-mobile#18851 [Telemetry] Send an event when users click on the "set as default browser" entry in the toolbar menu
  • Loading branch information
Amejia481 committed Apr 14, 2021
1 parent e8d405b commit cb143b8
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 3 deletions.
40 changes: 40 additions & 0 deletions app/metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,32 @@ events:
notification_emails:
- fenix-core@mozilla.com
expires: "2021-07-01"
default_browser_changed:
type: event
description: |
Indicates the default browser was changed
bugs:
- https://github.com/mozilla-mobile/fenix/issues/18857
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/18895
data_sensitivity:
- interaction
notification_emails:
- fenix-core@mozilla.com
expires: "2021-10-01"
toolbar_menu_visible:
type: event
description: |
The 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"
total_uri_count:
type: counter
description: |
Expand Down Expand Up @@ -561,6 +587,20 @@ search_shortcuts:
- fenix-core@mozilla.com
expires: "2021-08-01"

experiments_default_browser:
toolbar_menu_clicked:
type: event
description: |
Set default browser was clicked from toolbar menu
bugs:
- https://github.com/mozilla-mobile/fenix/issues/18851
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 @@ -224,6 +224,8 @@ sealed class Event {
object SearchSuggestionClicked : Event()
object OpenedTabSuggestionClicked : Event()

object SetDefaultBrowserToolbarMenuClicked : Event()
object ToolbarMenuShown : 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 @@ -32,6 +32,7 @@ import org.mozilla.fenix.GleanMetrics.DownloadsMisc
import org.mozilla.fenix.GleanMetrics.DownloadsManagement
import org.mozilla.fenix.GleanMetrics.ErrorPage
import org.mozilla.fenix.GleanMetrics.Events
import org.mozilla.fenix.GleanMetrics.ExperimentsDefaultBrowser
import org.mozilla.fenix.GleanMetrics.FindInPage
import org.mozilla.fenix.GleanMetrics.History
import org.mozilla.fenix.GleanMetrics.LoginDialog
Expand Down Expand Up @@ -192,6 +193,15 @@ private val Event.wrapper: EventWrapper<*>?
{ Events.browserMenuAction.record(it) },
{ Events.browserMenuActionKeys.valueOf(it) }
)
is Event.SetDefaultBrowserToolbarMenuClicked -> EventWrapper<NoExtraKeys>(
{ ExperimentsDefaultBrowser.toolbarMenuClicked.record(it) }
)
is Event.ToolbarMenuShown -> EventWrapper<NoExtraKeys>(
{ Events.toolbarMenuVisible.record(it) }
)
is Event.ChangedToDefaultBrowser -> EventWrapper<NoExtraKeys>(
{ Events.defaultBrowserChanged.record(it) }
)
is Event.OpenedBookmark -> EventWrapper<NoExtraKeys>(
{ BookmarksManagement.open.record(it) }
)
Expand Down Expand Up @@ -819,7 +829,6 @@ private val Event.wrapper: EventWrapper<*>?
is Event.FennecToFenixMigrated -> null
is Event.AddonInstalled -> null
is Event.SearchWidgetInstalled -> null
is Event.ChangedToDefaultBrowser -> null
is Event.SyncAuthFromSharedReuse, Event.SyncAuthFromSharedCopy -> null
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ internal class ReleaseMetricController(
}

Component.BROWSER_TOOLBAR to ToolbarFacts.Items.MENU -> {
metadata?.get("customTab")?.let { Event.CustomTabsMenuOpened }
metadata?.get("customTab")?.let { Event.CustomTabsMenuOpened } ?: Event.ToolbarMenuShown
}
Component.BROWSER_MENU to BrowserMenuFacts.Items.WEB_EXTENSION_MENU_ITEM -> {
metadata?.get("id")?.let { Event.AddonsOpenInToolbarMenu(it.toString()) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ class DefaultBrowserToolbarMenuController(
)
}
is ToolbarMenu.Item.SetDefaultBrowser -> {
metrics.track(Event.SetDefaultBrowserToolbarMenuClicked)
activity.openSetDefaultBrowserOption()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,8 @@ 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 ->
Expand Down
3 changes: 3 additions & 0 deletions docs/metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ In addition to those built-in metrics, the following metrics are added to the pi
| events.app_received_intent |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |The system received an Intent for the HomeActivity. An intent is received an external entity wants to the app to display content. Intents can be received when the app is closed – at which point the app will be opened – or when the app is already opened – at which point the already open app will make changes such as loading a url. This can be used loosely as a heuristic for when the user requested to open the app. The HomeActivity encompasses the home screen and browser screen but may include other screens. This differs from the app_opened probe because it measures all startups, not just cold startup. |[mozilla-mobile/fenix#11940/](https://github.com/mozilla-mobile/fenix/pull/11940/), [mozilla-mobile/fenix#13958](https://github.com/mozilla-mobile/fenix/pull/13958#issuecomment-676857877)|<ul><li>source: The method used to open Fenix. Possible values are `app_icon`, `custom_tab`, `link` or `unknown` </li></ul>|2021-06-01 | |
| events.browser_menu_action |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A browser menu item was tapped |[mozilla-mobile/fenix#1214](https://github.com/mozilla-mobile/fenix/pull/1214#issue-264756708), [mozilla-mobile/fenix#5098](https://github.com/mozilla-mobile/fenix/pull/5098#issuecomment-529658996), [mozilla-mobile/fenix#6310](https://github.com/mozilla-mobile/fenix/pull/6310), [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 include: Settings, Help, Desktop Site toggle on/off, Find in Page, New Tab, Private Tab, Share, Report Site Issue, Back/Forward button, Reload Button, Quit, Reader Mode On, Reader Mode Off, Open In app, Add To Top Sites, Add-ons Manager, Bookmarks, History </li></ul>|2021-07-01 |2 |
| events.copy_url_tapped |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |An event that indicates that a user has selected copy option when long pressing on url bar. |[mozilla-mobile/fenix#16915](https://github.com/mozilla-mobile/fenix/pull/16915)||2021-05-10 |2 |
| events.default_browser_changed |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |Indicates the default browser was changed |[mozilla-mobile/fenix#18895](https://github.com/mozilla-mobile/fenix/pull/18895)||2021-10-01 |2 |
| events.entered_url |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user entered a url |[mozilla-mobile/fenix#1067](https://github.com/mozilla-mobile/fenix/pull/1067#issuecomment-474598673), [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>autocomplete: A boolean that tells us whether the URL was autofilled by an Autocomplete suggestion </li></ul>|2021-07-01 |2 |
| events.opened_link |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user opened a link with Fenix |[mozilla-mobile/fenix#5975](https://github.com/mozilla-mobile/fenix/pull/5975), [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>mode: The mode the link was opened in. Either 'PRIVATE' or 'NORMAL'. N.B.: this probe may be incorrectly implemented: see https://github.com/mozilla-mobile/fenix/issues/14133 </li></ul>|2021-07-01 |2 |
| events.performed_search |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user performed a search |[mozilla-mobile/fenix#1067](https://github.com/mozilla-mobile/fenix/pull/1067#issuecomment-474598673), [mozilla-mobile/fenix#1677](https://github.com/mozilla-mobile/fenix/pull/1677), [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>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>|2021-07-01 |2 |
Expand All @@ -141,7 +142,9 @@ In addition to those built-in metrics, the following metrics are added to the pi
| events.search_bar_tapped |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user tapped the search bar |[mozilla-mobile/fenix#1067](https://github.com/mozilla-mobile/fenix/pull/1067#issuecomment-474598673), [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>source: The view the user was on when they initiated the search (For example: `Home` or `Browser`) </li></ul>|2021-07-01 |2 |
| 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.toolbar_menu_visible |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |The browser menu was displayed from toolbar menu |[mozilla-mobile/fenix#18895](https://github.com/mozilla-mobile/fenix/pull/18895)||2021-10-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.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 |
| find_in_page.searched_page |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user searched the page |[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 cb143b8

Please sign in to comment.