1
0
Fork 0

For #7525 - Add telemetry for opening a top site in normal and private mode and removing a top site

master
Gabriel Luong 2020-01-07 15:06:27 -05:00 committed by Jeff Boek
parent 192eecdf5b
commit f93e141d52
5 changed files with 56 additions and 1 deletions

View File

@ -1667,3 +1667,38 @@ search_suggestions:
notification_emails:
- fenix-core@mozilla.com
expires: "2020-09-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:
- fenix-core@mozilla.com
expires: "2020-09-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:
- fenix-core@mozilla.com
expires: "2020-09-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:
- fenix-core@mozilla.com
expires: "2020-09-01"

View File

@ -39,6 +39,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.GleanMetrics.UserSpecifiedSearchEngines
import org.mozilla.fenix.ext.components
@ -456,6 +457,15 @@ private val Event.wrapper: EventWrapper<*>?
{ Logins.saveLoginsSettingChanged.record(it) },
{ Logins.saveLoginsSettingChangedKeys.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

View File

@ -127,6 +127,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()

View File

@ -260,6 +260,7 @@ class DefaultSessionControlController(
}
override fun handleOpenInPrivateTabClicked(topSite: TopSite) {
metrics.track(Event.TopSiteOpenInPrivateTab)
with(activity) {
browsingModeManager.mode = BrowsingMode.Private
openToBrowserAndLoad(
@ -288,6 +289,8 @@ class DefaultSessionControlController(
}
override fun handleRemoveTopSiteClicked(topSite: TopSite) {
metrics.track(Event.TopSiteRemoved)
lifecycleScope.launch(Dispatchers.IO) {
topSiteStorage.removeTopSite(topSite)
}
@ -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,

File diff suppressed because one or more lines are too long