mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-03 23:15:31 +00:00
Bug 1836167 - New telemetry in bookmarks
This commit is contained in:
parent
63773d9614
commit
144abb235c
@ -1652,6 +1652,103 @@ metrics:
|
|||||||
metadata:
|
metadata:
|
||||||
tags:
|
tags:
|
||||||
- China
|
- China
|
||||||
|
bookmarks_add:
|
||||||
|
type: labeled_counter
|
||||||
|
lifetime: application
|
||||||
|
description: |
|
||||||
|
A counter that indicates how many bookmarks a user has added.
|
||||||
|
|
||||||
|
The label for this counter is `<source>`.
|
||||||
|
|
||||||
|
`source` will be: `page_action_menu` as that is the only
|
||||||
|
entry point right now to add bookmarks.
|
||||||
|
send_in_pings:
|
||||||
|
- metrics
|
||||||
|
bugs:
|
||||||
|
- https://bugzilla.mozilla.org/show_bug.cgi?id=1836167
|
||||||
|
data_reviews:
|
||||||
|
- https://github.com/mozilla-mobile/firefox-android/pull/2375
|
||||||
|
data_sensitivity:
|
||||||
|
- interaction
|
||||||
|
notification_emails:
|
||||||
|
- android-probes@mozilla.com
|
||||||
|
- cgordon@mozilla.com
|
||||||
|
expires: never
|
||||||
|
metadata:
|
||||||
|
tags:
|
||||||
|
- Bookmarks
|
||||||
|
bookmarks_edit:
|
||||||
|
type: labeled_counter
|
||||||
|
lifetime: application
|
||||||
|
description: |
|
||||||
|
A counter that indicates how many bookmarks a user has edited.
|
||||||
|
|
||||||
|
The label for this counter is `<source>`.
|
||||||
|
|
||||||
|
`source` will be: `bookmark_edit_page` or `bookmark_panel`.
|
||||||
|
send_in_pings:
|
||||||
|
- metrics
|
||||||
|
bugs:
|
||||||
|
- https://bugzilla.mozilla.org/show_bug.cgi?id=1836167
|
||||||
|
data_reviews:
|
||||||
|
- https://github.com/mozilla-mobile/firefox-android/pull/2375
|
||||||
|
data_sensitivity:
|
||||||
|
- interaction
|
||||||
|
notification_emails:
|
||||||
|
- android-probes@mozilla.com
|
||||||
|
- cgordon@mozilla.com
|
||||||
|
expires: never
|
||||||
|
metadata:
|
||||||
|
tags:
|
||||||
|
- Bookmarks
|
||||||
|
bookmarks_delete:
|
||||||
|
type: labeled_counter
|
||||||
|
lifetime: application
|
||||||
|
description: |
|
||||||
|
A counter that indicates how many bookmarks a user has deleted.
|
||||||
|
|
||||||
|
The label for this counter is `<source>`.
|
||||||
|
|
||||||
|
`source` will be: `add_bookmark_toast` or `bookmark_panel`.
|
||||||
|
send_in_pings:
|
||||||
|
- metrics
|
||||||
|
bugs:
|
||||||
|
- https://bugzilla.mozilla.org/show_bug.cgi?id=1836167
|
||||||
|
data_reviews:
|
||||||
|
- https://github.com/mozilla-mobile/firefox-android/pull/2375
|
||||||
|
data_sensitivity:
|
||||||
|
- interaction
|
||||||
|
notification_emails:
|
||||||
|
- android-probes@mozilla.com
|
||||||
|
- cgordon@mozilla.com
|
||||||
|
expires: never
|
||||||
|
metadata:
|
||||||
|
tags:
|
||||||
|
- Bookmarks
|
||||||
|
bookmarks_open:
|
||||||
|
type: labeled_counter
|
||||||
|
lifetime: application
|
||||||
|
description: |
|
||||||
|
A counter that indicates how many bookmarks a user has opened.
|
||||||
|
|
||||||
|
The label for this counter is `<source>`.
|
||||||
|
|
||||||
|
`source` will be: `top_sites`, `awesomebar_results`, `bookmark_panel`.
|
||||||
|
send_in_pings:
|
||||||
|
- metrics
|
||||||
|
bugs:
|
||||||
|
- https://bugzilla.mozilla.org/show_bug.cgi?id=1836167
|
||||||
|
data_reviews:
|
||||||
|
- https://github.com/mozilla-mobile/firefox-android/pull/2375
|
||||||
|
data_sensitivity:
|
||||||
|
- interaction
|
||||||
|
notification_emails:
|
||||||
|
- android-probes@mozilla.com
|
||||||
|
- cgordon@mozilla.com
|
||||||
|
expires: never
|
||||||
|
metadata:
|
||||||
|
tags:
|
||||||
|
- Bookmarks
|
||||||
mobile_bookmarks_count:
|
mobile_bookmarks_count:
|
||||||
type: counter
|
type: counter
|
||||||
lifetime: application
|
lifetime: application
|
||||||
@ -1670,7 +1767,7 @@ metrics:
|
|||||||
- https://github.com/mozilla-mobile/fenix/pull/16942#issuecomment-742794701
|
- https://github.com/mozilla-mobile/fenix/pull/16942#issuecomment-742794701
|
||||||
- https://github.com/mozilla-mobile/fenix/pull/19924#issuecomment-861423789
|
- https://github.com/mozilla-mobile/fenix/pull/19924#issuecomment-861423789
|
||||||
- https://github.com/mozilla-mobile/fenix/pull/20517#pullrequestreview-718069041
|
- https://github.com/mozilla-mobile/fenix/pull/20517#pullrequestreview-718069041
|
||||||
- https://github.com/mozilla-mobile/fenix/pull/21038#issuecomment-906757301
|
- https://github.com/mozilla-mobile/fenix/pull/21038#issuecomment-9067573./01
|
||||||
data_sensitivity:
|
data_sensitivity:
|
||||||
- interaction
|
- interaction
|
||||||
notification_emails:
|
notification_emails:
|
||||||
|
@ -118,6 +118,7 @@ import org.mozilla.fenix.browser.readermode.DefaultReaderModeController
|
|||||||
import org.mozilla.fenix.components.FenixSnackbar
|
import org.mozilla.fenix.components.FenixSnackbar
|
||||||
import org.mozilla.fenix.components.FindInPageIntegration
|
import org.mozilla.fenix.components.FindInPageIntegration
|
||||||
import org.mozilla.fenix.components.StoreProvider
|
import org.mozilla.fenix.components.StoreProvider
|
||||||
|
import org.mozilla.fenix.components.metrics.MetricsUtils
|
||||||
import org.mozilla.fenix.components.toolbar.BrowserFragmentState
|
import org.mozilla.fenix.components.toolbar.BrowserFragmentState
|
||||||
import org.mozilla.fenix.components.toolbar.BrowserFragmentStore
|
import org.mozilla.fenix.components.toolbar.BrowserFragmentStore
|
||||||
import org.mozilla.fenix.components.toolbar.BrowserToolbarView
|
import org.mozilla.fenix.components.toolbar.BrowserToolbarView
|
||||||
@ -1403,6 +1404,7 @@ abstract class BaseBrowserFragment :
|
|||||||
position = null,
|
position = null,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
MetricsUtils.recordBookmarkMetrics(MetricsUtils.BookmarkAction.ADD, METRIC_SOURCE)
|
||||||
withContext(Main) {
|
withContext(Main) {
|
||||||
view?.let {
|
view?.let {
|
||||||
FenixSnackbar.make(
|
FenixSnackbar.make(
|
||||||
@ -1412,6 +1414,10 @@ abstract class BaseBrowserFragment :
|
|||||||
)
|
)
|
||||||
.setText(getString(R.string.bookmark_saved_snackbar))
|
.setText(getString(R.string.bookmark_saved_snackbar))
|
||||||
.setAction(getString(R.string.edit_bookmark_snackbar_action)) {
|
.setAction(getString(R.string.edit_bookmark_snackbar_action)) {
|
||||||
|
MetricsUtils.recordBookmarkMetrics(
|
||||||
|
MetricsUtils.BookmarkAction.EDIT,
|
||||||
|
TOAST_METRIC_SOURCE,
|
||||||
|
)
|
||||||
nav(
|
nav(
|
||||||
R.id.browserFragment,
|
R.id.browserFragment,
|
||||||
BrowserFragmentDirections.actionGlobalBookmarkEditFragment(
|
BrowserFragmentDirections.actionGlobalBookmarkEditFragment(
|
||||||
@ -1566,6 +1572,8 @@ abstract class BaseBrowserFragment :
|
|||||||
private const val REQUEST_CODE_DOWNLOAD_PERMISSIONS = 1
|
private const val REQUEST_CODE_DOWNLOAD_PERMISSIONS = 1
|
||||||
private const val REQUEST_CODE_PROMPT_PERMISSIONS = 2
|
private const val REQUEST_CODE_PROMPT_PERMISSIONS = 2
|
||||||
private const val REQUEST_CODE_APP_PERMISSIONS = 3
|
private const val REQUEST_CODE_APP_PERMISSIONS = 3
|
||||||
|
private const val METRIC_SOURCE = "page_action_menu"
|
||||||
|
private const val TOAST_METRIC_SOURCE = "add_bookmark_toast"
|
||||||
|
|
||||||
val onboardingLinksList: List<String> = listOf(
|
val onboardingLinksList: List<String> = listOf(
|
||||||
SupportUtils.getMozillaPageUrl(SupportUtils.MozillaPage.PRIVATE_NOTICE),
|
SupportUtils.getMozillaPageUrl(SupportUtils.MozillaPage.PRIVATE_NOTICE),
|
||||||
|
@ -60,6 +60,30 @@ object MetricsUtils {
|
|||||||
Events.performedSearch.record(Events.PerformedSearchExtra(performedSearchExtra))
|
Events.performedSearch.record(Events.PerformedSearchExtra(performedSearchExtra))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Records the appropriate metric for performed Bookmark action.
|
||||||
|
* @param action The [BookmarkAction] being counted.
|
||||||
|
* @param source Describes where the action was called from.
|
||||||
|
*/
|
||||||
|
fun recordBookmarkMetrics(
|
||||||
|
action: BookmarkAction,
|
||||||
|
source: String,
|
||||||
|
) {
|
||||||
|
when (action) {
|
||||||
|
BookmarkAction.ADD -> Metrics.bookmarksAdd[source].add()
|
||||||
|
BookmarkAction.EDIT -> Metrics.bookmarksEdit[source].add()
|
||||||
|
BookmarkAction.DELETE -> Metrics.bookmarksDelete[source].add()
|
||||||
|
BookmarkAction.OPEN -> Metrics.bookmarksOpen[source].add()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Describes which bookmark action is being recorded.
|
||||||
|
*/
|
||||||
|
enum class BookmarkAction {
|
||||||
|
ADD, EDIT, DELETE, OPEN
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the default salt to use for hashing. This is a convenience
|
* Get the default salt to use for hashing. This is a convenience
|
||||||
* function to help with unit tests.
|
* function to help with unit tests.
|
||||||
|
@ -9,6 +9,7 @@ import mozilla.components.concept.storage.BookmarkNodeType
|
|||||||
import mozilla.telemetry.glean.private.NoExtras
|
import mozilla.telemetry.glean.private.NoExtras
|
||||||
import org.mozilla.fenix.GleanMetrics.BookmarksManagement
|
import org.mozilla.fenix.GleanMetrics.BookmarksManagement
|
||||||
import org.mozilla.fenix.browser.browsingmode.BrowsingMode
|
import org.mozilla.fenix.browser.browsingmode.BrowsingMode
|
||||||
|
import org.mozilla.fenix.components.metrics.MetricsUtils
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interactor for the Bookmarks screen.
|
* Interactor for the Bookmarks screen.
|
||||||
@ -33,6 +34,10 @@ class BookmarkFragmentInteractor(
|
|||||||
|
|
||||||
override fun onEditPressed(node: BookmarkNode) {
|
override fun onEditPressed(node: BookmarkNode) {
|
||||||
bookmarksController.handleBookmarkEdit(node)
|
bookmarksController.handleBookmarkEdit(node)
|
||||||
|
MetricsUtils.recordBookmarkMetrics(
|
||||||
|
MetricsUtils.BookmarkAction.EDIT,
|
||||||
|
METRIC_SOURCE,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onAllBookmarksDeselected() {
|
override fun onAllBookmarksDeselected() {
|
||||||
@ -69,6 +74,10 @@ class BookmarkFragmentInteractor(
|
|||||||
bookmarksController.handleOpeningBookmark(item, BrowsingMode.Normal)
|
bookmarksController.handleOpeningBookmark(item, BrowsingMode.Normal)
|
||||||
BookmarksManagement.openInNewTab.record(NoExtras())
|
BookmarksManagement.openInNewTab.record(NoExtras())
|
||||||
}
|
}
|
||||||
|
MetricsUtils.recordBookmarkMetrics(
|
||||||
|
MetricsUtils.BookmarkAction.OPEN,
|
||||||
|
METRIC_SOURCE,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onOpenInPrivateTab(item: BookmarkNode) {
|
override fun onOpenInPrivateTab(item: BookmarkNode) {
|
||||||
@ -77,16 +86,28 @@ class BookmarkFragmentInteractor(
|
|||||||
bookmarksController.handleOpeningBookmark(item, BrowsingMode.Private)
|
bookmarksController.handleOpeningBookmark(item, BrowsingMode.Private)
|
||||||
BookmarksManagement.openInPrivateTab.record(NoExtras())
|
BookmarksManagement.openInPrivateTab.record(NoExtras())
|
||||||
}
|
}
|
||||||
|
MetricsUtils.recordBookmarkMetrics(
|
||||||
|
MetricsUtils.BookmarkAction.OPEN,
|
||||||
|
METRIC_SOURCE,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onOpenAllInNewTabs(folder: BookmarkNode) {
|
override fun onOpenAllInNewTabs(folder: BookmarkNode) {
|
||||||
require(folder.type == BookmarkNodeType.FOLDER)
|
require(folder.type == BookmarkNodeType.FOLDER)
|
||||||
bookmarksController.handleOpeningFolderBookmarks(folder, BrowsingMode.Normal)
|
bookmarksController.handleOpeningFolderBookmarks(folder, BrowsingMode.Normal)
|
||||||
|
MetricsUtils.recordBookmarkMetrics(
|
||||||
|
MetricsUtils.BookmarkAction.OPEN,
|
||||||
|
METRIC_SOURCE,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onOpenAllInPrivateTabs(folder: BookmarkNode) {
|
override fun onOpenAllInPrivateTabs(folder: BookmarkNode) {
|
||||||
require(folder.type == BookmarkNodeType.FOLDER)
|
require(folder.type == BookmarkNodeType.FOLDER)
|
||||||
bookmarksController.handleOpeningFolderBookmarks(folder, BrowsingMode.Private)
|
bookmarksController.handleOpeningFolderBookmarks(folder, BrowsingMode.Private)
|
||||||
|
MetricsUtils.recordBookmarkMetrics(
|
||||||
|
MetricsUtils.BookmarkAction.OPEN,
|
||||||
|
METRIC_SOURCE,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDelete(nodes: Set<BookmarkNode>) {
|
override fun onDelete(nodes: Set<BookmarkNode>) {
|
||||||
@ -100,6 +121,10 @@ class BookmarkFragmentInteractor(
|
|||||||
BookmarkNodeType.FOLDER -> BookmarkRemoveType.FOLDER
|
BookmarkNodeType.FOLDER -> BookmarkRemoveType.FOLDER
|
||||||
null -> BookmarkRemoveType.MULTIPLE
|
null -> BookmarkRemoveType.MULTIPLE
|
||||||
}
|
}
|
||||||
|
MetricsUtils.recordBookmarkMetrics(
|
||||||
|
MetricsUtils.BookmarkAction.DELETE,
|
||||||
|
METRIC_SOURCE,
|
||||||
|
)
|
||||||
if (eventType == BookmarkRemoveType.FOLDER) {
|
if (eventType == BookmarkRemoveType.FOLDER) {
|
||||||
bookmarksController.handleBookmarkFolderDeletion(nodes)
|
bookmarksController.handleBookmarkFolderDeletion(nodes)
|
||||||
} else {
|
} else {
|
||||||
@ -133,4 +158,8 @@ class BookmarkFragmentInteractor(
|
|||||||
override fun onRequestSync() {
|
override fun onRequestSync() {
|
||||||
bookmarksController.handleRequestSync()
|
bookmarksController.handleRequestSync()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
const val METRIC_SOURCE = "bookmark_panel"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,7 @@ import org.mozilla.fenix.GleanMetrics.BookmarksManagement
|
|||||||
import org.mozilla.fenix.NavHostActivity
|
import org.mozilla.fenix.NavHostActivity
|
||||||
import org.mozilla.fenix.R
|
import org.mozilla.fenix.R
|
||||||
import org.mozilla.fenix.components.FenixSnackbar
|
import org.mozilla.fenix.components.FenixSnackbar
|
||||||
|
import org.mozilla.fenix.components.metrics.MetricsUtils
|
||||||
import org.mozilla.fenix.databinding.FragmentEditBookmarkBinding
|
import org.mozilla.fenix.databinding.FragmentEditBookmarkBinding
|
||||||
import org.mozilla.fenix.ext.components
|
import org.mozilla.fenix.ext.components
|
||||||
import org.mozilla.fenix.ext.getRootView
|
import org.mozilla.fenix.ext.getRootView
|
||||||
@ -222,6 +223,7 @@ class EditBookmarkFragment : Fragment(R.layout.fragment_edit_bookmark), MenuProv
|
|||||||
lifecycleScope.launch(IO) {
|
lifecycleScope.launch(IO) {
|
||||||
requireComponents.core.bookmarksStorage.deleteNode(args.guidToEdit)
|
requireComponents.core.bookmarksStorage.deleteNode(args.guidToEdit)
|
||||||
BookmarksManagement.removed.record(NoExtras())
|
BookmarksManagement.removed.record(NoExtras())
|
||||||
|
MetricsUtils.recordBookmarkMetrics(MetricsUtils.BookmarkAction.DELETE, METRIC_SOURCE)
|
||||||
|
|
||||||
launch(Main) {
|
launch(Main) {
|
||||||
Navigation.findNavController(requireActivity(), R.id.container)
|
Navigation.findNavController(requireActivity(), R.id.container)
|
||||||
@ -312,4 +314,8 @@ class EditBookmarkFragment : Fragment(R.layout.fragment_edit_bookmark), MenuProv
|
|||||||
|
|
||||||
_binding = null
|
_binding = null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private const val METRIC_SOURCE = "bookmark_edit_page"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user