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

Commit

Permalink
For #7525 - Add telemetry for opening a top site in normal and privat…
Browse files Browse the repository at this point in the history
…e mode and removing a top site
  • Loading branch information
gabrielluong committed Jan 7, 2020
1 parent 7526758 commit 7595f28
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 1 deletion.
37 changes: 36 additions & 1 deletion app/metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1669,4 +1669,39 @@ search_suggestions:
- https://github.com/mozilla-mobile/fenix/pull/6746
notification_emails:
- [email protected]
expires: "2020-03-01"
expires: "2020-03-01"

top_sites:
open_in_new_tab:
type: event
description: >
A user opens a new tab based on a top site item
bugs:
- https://github.com/mozilla-mobile/fenix/issues/6757
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/7523
notification_emails:
- [email protected]
expires: "2020-03-01"
open_in_private_tab:
type: event
description: >
A user opens a new private tab based on a top site item
bugs:
- https://github.com/mozilla-mobile/fenix/issues/6757
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/7523
notification_emails:
- [email protected]
expires: "2020-03-01"
remove:
type: event
description: >
A user removes a top site item
bugs:
- https://github.com/mozilla-mobile/fenix/issues/6757
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/7523
notification_emails:
- [email protected]
expires: "2020-03-01"
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import org.mozilla.fenix.GleanMetrics.SyncAccount
import org.mozilla.fenix.GleanMetrics.SyncAuth
import org.mozilla.fenix.GleanMetrics.Tab
import org.mozilla.fenix.GleanMetrics.ToolbarSettings
import org.mozilla.fenix.GleanMetrics.TopSites
import org.mozilla.fenix.GleanMetrics.TrackingProtection
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.settings
Expand Down Expand Up @@ -454,6 +455,15 @@ private val Event.wrapper: EventWrapper<*>?
{ ToolbarSettings.changedPosition.record(it) },
{ ToolbarSettings.changedPositionKeys.valueOf(it) }
)
is Event.TopSiteOpenInNewTab -> EventWrapper<NoExtraKeys>(
{ TopSites.openInNewTab.record(it) }
)
is Event.TopSiteOpenInPrivateTab -> EventWrapper<NoExtraKeys>(
{ TopSites.openInPrivateTab.record(it) }
)
is Event.TopSiteRemoved -> EventWrapper<NoExtraKeys>(
{ TopSites.remove.record(it) }
)
// Don't record other events in Glean:
is Event.AddBookmark -> null
is Event.OpenedBookmark -> null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ sealed class Event {
object NotificationDownloadTryAgain : Event()
object NotificationMediaPlay : Event()
object NotificationMediaPause : Event()
object TopSiteOpenInNewTab : Event()
object TopSiteOpenInPrivateTab : Event()
object TopSiteRemoved : Event()
object TrackingProtectionTrackerList : Event()
object TrackingProtectionIconPressed : Event()
object TrackingProtectionSettingsPanel : Event()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ class DefaultSessionControlController(
}

override fun handleOpenInPrivateTabClicked(topSite: TopSite) {
metrics.track(Event.TopSiteOpenInPrivateTab)
with(activity) {
browsingModeManager.mode = BrowsingMode.Private
openToBrowserAndLoad(
Expand Down Expand Up @@ -288,6 +289,8 @@ class DefaultSessionControlController(
}

override fun handleRemoveTopSiteClicked(topSite: TopSite) {
metrics.track(Event.TopSiteRemoved)

lifecycleScope.launch(Dispatchers.IO) {
topSiteStorage.removeTopSite(topSite)
}
Expand Down Expand Up @@ -336,6 +339,7 @@ class DefaultSessionControlController(
}

override fun handleSelectTopSite(url: String) {
metrics.track(Event.TopSiteOpenInNewTab)
activity.components.useCases.tabsUseCases.addTab.invoke(url, true, true)
navController.nav(
R.id.homeFragment,
Expand Down
3 changes: 3 additions & 0 deletions docs/metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ The following metrics are added to the ping:
| tab.media_pause |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user pressed the pause icon on a tab from the home screen |[1](https://github.com/mozilla-mobile/fenix/pull/5266)||2020-03-01 |
| tab.media_play |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user pressed the play icon on a tab from the home screen |[1](https://github.com/mozilla-mobile/fenix/pull/5266)||2020-03-01 |
| toolbar_settings.changed_position |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |The user selected a new position for the toolbar |[1](https://github.com/mozilla-mobile/fenix/pull/6608)|<ul><li>position: A string that indicates the new position of the toolbar TOP or BOTTOM</li></ul>|2020-03-01 |
| top_sites.open_in_new_tab |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user opens a new tab based on a top site item |[1](https://github.com/mozilla-mobile/fenix/pull/7523)||2020-03-01 |
| top_sites.open_in_private_tab |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user opens a new private tab based on a top site item |[1](https://github.com/mozilla-mobile/fenix/pull/7523)||2020-03-01 |
| top_sites.remove |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user removes a top site item |[1](https://github.com/mozilla-mobile/fenix/pull/7523)||2020-03-01 |
| tracking_protection.etp_setting_changed |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user changed their tracking protection level setting to either strict or standard. |[1](https://github.com/mozilla-mobile/fenix/pull/5414#issuecomment-532847188)|<ul><li>etp_setting: The new setting for ETP: strict, standard</li></ul>|2020-03-01 |
| tracking_protection.etp_settings |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user opened tracking protection settings through settings. |[1](https://github.com/mozilla-mobile/fenix/pull/5414#issuecomment-532847188)||2020-03-01 |
| tracking_protection.etp_shield |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user pressed the tracking protection shield icon in toolbar. |[1](https://github.com/mozilla-mobile/fenix/pull/5414#issuecomment-532847188)||2020-03-01 |
Expand Down

0 comments on commit 7595f28

Please sign in to comment.