For #11580 - Tracks text selection context menu usage (#16968)

* For #11580 - Tracks text selection context menu usage

Tracks Copy, Search, Select All and Share items from the text selection context menu. Uses AC's DefaultSelectionActionDelegate to achieve this.

Co-authored-by: Gabriel Luong <gabriel.luong@gmail.com>
This commit is contained in:
Codrut Topliceanu 2021-01-04 16:28:01 +02:00 committed by GitHub
parent b34cc24f88
commit c0f0c401f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 114 additions and 0 deletions

View File

@ -4260,3 +4260,70 @@ tabs:
notification_emails:
- fenix-core@mozilla.com
expires: "2021-08-01"
contextual_menu:
long_press_tapped:
type: boolean
description: |
Text selection contextual menu option tapped.
bugs:
- https://github.com/mozilla-mobile/fenix/issues/11580
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/16968
data_sensitivity:
- interaction
notification_emails:
- fenix-core@mozilla.com
expires: "2021-06-01"
copy_tapped:
type: event
description: |
The context menu's 'copy' option was used.
bugs:
- https://github.com/mozilla-mobile/fenix/issues/11580
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/16968
data_sensitivity:
- interaction
notification_emails:
- fenix-core@mozilla.com
expires: "2021-06-01"
search_tapped:
type: event
description: |
The context menu's 'search' option was used.
bugs:
- https://github.com/mozilla-mobile/fenix/issues/11580
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/16968
data_sensitivity:
- interaction
notification_emails:
- fenix-core@mozilla.com
expires: "2021-06-01"
select_all_tapped:
type: event
description: |
The context menu's 'select all' option was used.
bugs:
- https://github.com/mozilla-mobile/fenix/issues/11580
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/16968
data_sensitivity:
- interaction
notification_emails:
- fenix-core@mozilla.com
expires: "2021-06-01"
share_tapped:
type: event
description: |
The context menu's 'share' option was used.
bugs:
- https://github.com/mozilla-mobile/fenix/issues/11580
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/16968
data_sensitivity:
- interaction
notification_emails:
- fenix-core@mozilla.com
expires: "2021-06-01"

View File

@ -195,6 +195,12 @@ sealed class Event {
object RecentlyClosedTabsOpened : Event()
object ContextMenuLongPressTapped : Event()
object ContextMenuCopyTapped : Event()
object ContextMenuSearchTapped : Event()
object ContextMenuSelectAllTapped : Event()
object ContextMenuShareTapped : Event()
// Interaction events with extras
data class TopSiteSwipeCarousel(val page: Int) : Event() {

View File

@ -22,6 +22,7 @@ import org.mozilla.fenix.GleanMetrics.BrowserSearch
import org.mozilla.fenix.GleanMetrics.Collections
import org.mozilla.fenix.GleanMetrics.ContextMenu
import org.mozilla.fenix.GleanMetrics.ContextualHintTrackingProtection
import org.mozilla.fenix.GleanMetrics.ContextualMenu
import org.mozilla.fenix.GleanMetrics.CrashReporter
import org.mozilla.fenix.GleanMetrics.CustomTab
import org.mozilla.fenix.GleanMetrics.DownloadNotification
@ -700,6 +701,21 @@ private val Event.wrapper: EventWrapper<*>?
Event.TabSettingsOpened -> EventWrapper<NoExtraKeys>(
{ Tabs.settingOpened.record(it) }
)
Event.ContextMenuLongPressTapped -> EventWrapper<NoExtraKeys>(
{ ContextualMenu.longPressTapped.set(true) }
)
Event.ContextMenuCopyTapped -> EventWrapper<NoExtraKeys>(
{ ContextualMenu.copyTapped.record(it) }
)
Event.ContextMenuSearchTapped -> EventWrapper<NoExtraKeys>(
{ ContextualMenu.searchTapped.record(it) }
)
Event.ContextMenuSelectAllTapped -> EventWrapper<NoExtraKeys>(
{ ContextualMenu.selectAllTapped.record(it) }
)
Event.ContextMenuShareTapped -> EventWrapper<NoExtraKeys>(
{ ContextualMenu.shareTapped.record(it) }
)
// Don't record other events in Glean:
is Event.AddBookmark -> null

View File

@ -153,6 +153,15 @@ internal class ReleaseMetricController(
Component.FEATURE_CONTEXTMENU to ContextMenuFacts.Items.ITEM -> {
metadata?.get("item")?.let { Event.ContextMenuItemTapped.create(it.toString()) }
}
Component.FEATURE_CONTEXTMENU to ContextMenuFacts.Items.TEXT_SELECTION_OPTION -> {
when (metadata?.get("textSelectionOption")?.toString()) {
CONTEXT_MENU_COPY -> Event.ContextMenuCopyTapped
CONTEXT_MENU_SEARCH, CONTEXT_MENU_SEARCH_PRIVATELY -> Event.ContextMenuSearchTapped
CONTEXT_MENU_SELECT_ALL -> Event.ContextMenuSelectAllTapped
CONTEXT_MENU_SHARE -> Event.ContextMenuShareTapped
else -> null
}
}
Component.BROWSER_TOOLBAR to ToolbarFacts.Items.MENU -> {
metadata?.get("customTab")?.let { Event.CustomTabsMenuOpened }
@ -235,4 +244,15 @@ internal class ReleaseMetricController(
}
else -> null
}
companion object {
/**
* Text selection long press context items to be tracked.
*/
const val CONTEXT_MENU_COPY = "org.mozilla.geckoview.COPY"
const val CONTEXT_MENU_SEARCH = "CUSTOM_CONTEXT_MENU_SEARCH"
const val CONTEXT_MENU_SEARCH_PRIVATELY = "CUSTOM_CONTEXT_MENU_SEARCH_PRIVATELY"
const val CONTEXT_MENU_SELECT_ALL = "org.mozilla.geckoview.SELECT_ALL"
const val CONTEXT_MENU_SHARE = "CUSTOM_CONTEXT_MENU_SHARE"
}
}

View File

@ -85,6 +85,10 @@ The following metrics are added to the ping:
| contextual_hint.tracking_protection.display |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |The enhanced tracking protection contextual hint was displayed. |[1](https://github.com/mozilla-mobile/fenix/pull/11923), [2](https://github.com/mozilla-mobile/fenix/pull/13958#issuecomment-676857877)||2021-04-01 |2 |
| contextual_hint.tracking_protection.inside_tap |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |The user tapped inside of the etp contextual hint (which brings up the etp panel for this site). |[1](https://github.com/mozilla-mobile/fenix/pull/11923), [2](https://github.com/mozilla-mobile/fenix/pull/13958#issuecomment-676857877)||2021-04-01 |2 |
| contextual_hint.tracking_protection.outside_tap |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |The user tapped outside of the etp contextual hint (which has no effect). |[1](https://github.com/mozilla-mobile/fenix/pull/11923), [2](https://github.com/mozilla-mobile/fenix/pull/13958#issuecomment-676857877)||2021-04-01 |2 |
| contextual_menu.copy_tapped |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |The context menu's 'copy' option was used. |[1](https://github.com/mozilla-mobile/fenix/pull/16968)||2021-06-01 |2 |
| contextual_menu.search_tapped |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |The context menu's 'search' option was used. |[1](https://github.com/mozilla-mobile/fenix/pull/16968)||2021-06-01 |2 |
| contextual_menu.select_all_tapped |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |The context menu's 'select all' option was used. |[1](https://github.com/mozilla-mobile/fenix/pull/16968)||2021-06-01 |2 |
| contextual_menu.share_tapped |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |The context menu's 'share' option was used. |[1](https://github.com/mozilla-mobile/fenix/pull/16968)||2021-06-01 |2 |
| crash_reporter.closed |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |The crash reporter was closed |[1](https://github.com/mozilla-mobile/fenix/pull/1214#issue-264756708), [2](https://github.com/mozilla-mobile/fenix/pull/13958#issuecomment-676857877)|<ul><li>crash_submitted: A boolean that tells us whether or not the user submitted a crash report </li></ul>|2021-04-01 |2 |
| crash_reporter.opened |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |The crash reporter was displayed |[1](https://github.com/mozilla-mobile/fenix/pull/1214#issue-264756708), [2](https://github.com/mozilla-mobile/fenix/pull/13958#issuecomment-676857877)||2021-04-01 |2 |
| custom_tab.action_button |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user pressed the action button provided by the launching app |[1](https://github.com/mozilla-mobile/fenix/pull/1697), [2](https://github.com/mozilla-mobile/fenix/pull/13958#issuecomment-676857877)||2021-04-01 |2 |
@ -270,6 +274,7 @@ The following metrics are added to the ping:
| browser.search.ad_clicks |[labeled_counter](https://mozilla.github.io/glean/book/user/metrics/labeled_counters.html) |Records clicks of adverts on SERP pages. The key format is <provider-name>. |[1](https://github.com/mozilla-mobile/fenix/pull/10112), [2](https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068)||2021-08-01 |2 |
| browser.search.in_content |[labeled_counter](https://mozilla.github.io/glean/book/user/metrics/labeled_counters.html) |Records the type of interaction a user has on SERP pages. |[1](https://github.com/mozilla-mobile/fenix/pull/10167), [2](https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068)||2021-08-01 |2 |
| browser.search.with_ads |[labeled_counter](https://mozilla.github.io/glean/book/user/metrics/labeled_counters.html) |Records counts of SERP pages with adverts displayed. The key format is <provider-name>. |[1](https://github.com/mozilla-mobile/fenix/pull/10112), [2](https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068)||2021-08-01 |2 |
| contextual_menu.long_press_tapped |[boolean](https://mozilla.github.io/glean/book/user/metrics/boolean.html) |Text selection contextual menu option tapped. |[1](https://github.com/mozilla-mobile/fenix/pull/16968)||2021-06-01 |2 |
| events.total_uri_count |[counter](https://mozilla.github.io/glean/book/user/metrics/counter.html) |A counter of URIs visited by the user in the current session, including page reloads. This does not include background page requests and URIs from embedded pages or private browsing but may be incremented without user interaction by website scripts that programmatically redirect to a new location. |[1](https://github.com/mozilla-mobile/fenix/pull/1785), [2](https://github.com/mozilla-mobile/fenix/pull/8314), [3](https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068)||2021-08-01 |2 |
| metrics.adjust_ad_group |[string](https://mozilla.github.io/glean/book/user/metrics/string.html) |A string containing the Adjust ad group ID from which the user installed Fenix. This will not send on the first session the user runs. If the install is organic, this will be empty. |[1](https://github.com/mozilla-mobile/fenix/pull/9253), [2](https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068)||2021-08-01 |2 |
| metrics.adjust_campaign |[string](https://mozilla.github.io/glean/book/user/metrics/string.html) |A string containing the Adjust campaign ID from which the user installed Fenix. This will not send on the first session the user runs. If the install is organic, this will be empty. |[1](https://github.com/mozilla-mobile/fenix/pull/5579), [2](https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068)||2021-08-01 |1 |