mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-15 18:12:54 +00:00
[fenix] Closes https://github.com/mozilla-mobile/fenix/issues/1194: Adds shortcut telemetry
This commit is contained in:
parent
c0e546a533
commit
d56e5d1933
@ -55,6 +55,8 @@ events:
|
|||||||
extra_keys:
|
extra_keys:
|
||||||
search_suggestion:
|
search_suggestion:
|
||||||
description: "A boolean that tells us whether or not the search term was suggested by the Awesomebar"
|
description: "A boolean that tells us whether or not the search term was suggested by the Awesomebar"
|
||||||
|
search_shortcut:
|
||||||
|
description: "A boolean that tells us whether or not the search was conducted through a search shortcut"
|
||||||
bugs:
|
bugs:
|
||||||
- 959
|
- 959
|
||||||
data_reviews:
|
data_reviews:
|
||||||
@ -62,6 +64,42 @@ events:
|
|||||||
notification_emails:
|
notification_emails:
|
||||||
- telemetry-client-dev@mozilla.com
|
- telemetry-client-dev@mozilla.com
|
||||||
expires: "2020-03-01"
|
expires: "2020-03-01"
|
||||||
|
ss_menu_opened:
|
||||||
|
type: event
|
||||||
|
description: >
|
||||||
|
A user opened the search shortcut menu in the search view by pressing the shortcuts button
|
||||||
|
bugs:
|
||||||
|
- 793
|
||||||
|
data_reviews:
|
||||||
|
- https://github.com/mozilla-mobile/fenix/pull/1202#issuecomment-476870449
|
||||||
|
notification_emails:
|
||||||
|
- telemetry-client-dev@mozilla.com
|
||||||
|
expires: "2020-03-01"
|
||||||
|
ss_menu_closed:
|
||||||
|
type: event
|
||||||
|
description: >
|
||||||
|
A user closed the search shortcut menu in the search view by pressing the shortcuts button
|
||||||
|
bugs:
|
||||||
|
- 793
|
||||||
|
data_reviews:
|
||||||
|
- https://github.com/mozilla-mobile/fenix/pull/1202#issuecomment-476870449
|
||||||
|
notification_emails:
|
||||||
|
- telemetry-client-dev@mozilla.com
|
||||||
|
expires: "2020-03-01"
|
||||||
|
ss_selected:
|
||||||
|
type: event
|
||||||
|
description: >
|
||||||
|
A user selected a search shortcut engine to use
|
||||||
|
extra_keys:
|
||||||
|
engine:
|
||||||
|
description: "The name of the built-in search engine the user selected as a string"
|
||||||
|
bugs:
|
||||||
|
- 793
|
||||||
|
data_reviews:
|
||||||
|
- https://github.com/mozilla-mobile/fenix/pull/1202#issuecomment-476870449
|
||||||
|
notification_emails:
|
||||||
|
- telemetry-client-dev@mozilla.com
|
||||||
|
expires: "2020-03-01"
|
||||||
|
|
||||||
metrics:
|
metrics:
|
||||||
default_browser:
|
default_browser:
|
||||||
|
@ -49,6 +49,9 @@ private val Event.name: String?
|
|||||||
is Event.SearchBarTapped -> ""
|
is Event.SearchBarTapped -> ""
|
||||||
is Event.EnteredUrl -> ""
|
is Event.EnteredUrl -> ""
|
||||||
is Event.PerformedSearch -> ""
|
is Event.PerformedSearch -> ""
|
||||||
|
is Event.SearchShortcutMenuOpened -> ""
|
||||||
|
is Event.SearchShortcutMenuClosed -> ""
|
||||||
|
is Event.SearchShortcutSelected -> ""
|
||||||
}
|
}
|
||||||
|
|
||||||
class LeanplumMetricsService(private val application: Application) : MetricsService {
|
class LeanplumMetricsService(private val application: Application) : MetricsService {
|
||||||
|
@ -43,6 +43,8 @@ sealed class Event {
|
|||||||
object UserDownloadedSend : Event()
|
object UserDownloadedSend : Event()
|
||||||
object OpenedPocketStory : Event()
|
object OpenedPocketStory : Event()
|
||||||
object DarkModeEnabled : Event()
|
object DarkModeEnabled : Event()
|
||||||
|
object SearchShortcutMenuOpened : Event()
|
||||||
|
object SearchShortcutMenuClosed : Event()
|
||||||
|
|
||||||
// Interaction Events
|
// Interaction Events
|
||||||
data class SearchBarTapped(val source: Source) : Event() {
|
data class SearchBarTapped(val source: Source) : Event() {
|
||||||
@ -56,9 +58,16 @@ sealed class Event {
|
|||||||
get() = mapOf("autocomplete" to autoCompleted.toString())
|
get() = mapOf("autocomplete" to autoCompleted.toString())
|
||||||
}
|
}
|
||||||
|
|
||||||
data class PerformedSearch(val fromSearchSuggestion: Boolean) : Event() {
|
data class PerformedSearch(val fromSearchSuggestion: Boolean, val fromSearchShortcut: Boolean) : Event() {
|
||||||
override val extras: Map<String, String>?
|
override val extras: Map<String, String>?
|
||||||
get() = mapOf("search_suggestion" to fromSearchSuggestion.toString())
|
get() = mapOf("search_suggestion" to fromSearchSuggestion.toString(),
|
||||||
|
"search_shortcut" to fromSearchShortcut.toString())
|
||||||
|
}
|
||||||
|
|
||||||
|
// Track only built-in engine selection. Do not track user-added engines!
|
||||||
|
data class SearchShortcutSelected(val engine: String) : Event() {
|
||||||
|
override val extras: Map<String, String>?
|
||||||
|
get() = mapOf("engine" to engine)
|
||||||
}
|
}
|
||||||
|
|
||||||
open val extras: Map<String, String>?
|
open val extras: Map<String, String>?
|
||||||
|
@ -84,9 +84,15 @@ class SearchFragment : Fragment() {
|
|||||||
view.toolbar_wrapper.clipToOutline = false
|
view.toolbar_wrapper.clipToOutline = false
|
||||||
|
|
||||||
search_shortcuts_button.setOnClickListener {
|
search_shortcuts_button.setOnClickListener {
|
||||||
getManagedEmitter<AwesomeBarChange>().onNext(AwesomeBarChange
|
val isOpen = (awesomeBarComponent.uiView as AwesomeBarUIView).state?.showShortcutEnginePicker ?: false
|
||||||
.SearchShortcutEnginePicker(!(
|
|
||||||
(awesomeBarComponent.uiView as AwesomeBarUIView).state?.showShortcutEnginePicker ?: true)))
|
getManagedEmitter<AwesomeBarChange>().onNext(AwesomeBarChange.SearchShortcutEnginePicker(!isOpen))
|
||||||
|
|
||||||
|
if (isOpen) {
|
||||||
|
requireComponents.analytics.metrics.track(Event.SearchShortcutMenuClosed)
|
||||||
|
} else {
|
||||||
|
requireComponents.analytics.metrics.track(Event.SearchShortcutMenuOpened)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,7 +119,9 @@ class SearchFragment : Fragment() {
|
|||||||
val event = if (it.url.isUrl()) {
|
val event = if (it.url.isUrl()) {
|
||||||
Event.EnteredUrl(false)
|
Event.EnteredUrl(false)
|
||||||
} else {
|
} else {
|
||||||
Event.PerformedSearch(false)
|
val isSearchShortcut = it.engine !=
|
||||||
|
requireComponents.search.searchEngineManager.defaultSearchEngine
|
||||||
|
Event.PerformedSearch(false, isSearchShortcut)
|
||||||
}
|
}
|
||||||
|
|
||||||
requireComponents.analytics.metrics.track(event)
|
requireComponents.analytics.metrics.track(event)
|
||||||
@ -142,13 +150,20 @@ class SearchFragment : Fragment() {
|
|||||||
getSearchUseCase(requireContext(), sessionId == null)
|
getSearchUseCase(requireContext(), sessionId == null)
|
||||||
.invoke(it.searchTerms, it.engine)
|
.invoke(it.searchTerms, it.engine)
|
||||||
(activity as HomeActivity).openToBrowser(sessionId, BrowserDirection.FromSearch)
|
(activity as HomeActivity).openToBrowser(sessionId, BrowserDirection.FromSearch)
|
||||||
requireComponents.analytics.metrics.track(Event.PerformedSearch(true))
|
|
||||||
|
val isSearchShortcut = it.engine !=
|
||||||
|
requireComponents.search.searchEngineManager.defaultSearchEngine
|
||||||
|
|
||||||
|
requireComponents.analytics.metrics
|
||||||
|
.track(Event.PerformedSearch(true, isSearchShortcut))
|
||||||
}
|
}
|
||||||
is AwesomeBarAction.SearchShortcutEngineSelected -> {
|
is AwesomeBarAction.SearchShortcutEngineSelected -> {
|
||||||
getManagedEmitter<AwesomeBarChange>()
|
getManagedEmitter<AwesomeBarChange>()
|
||||||
.onNext(AwesomeBarChange.SearchShortcutEngineSelected(it.engine))
|
.onNext(AwesomeBarChange.SearchShortcutEngineSelected(it.engine))
|
||||||
getManagedEmitter<SearchChange>()
|
getManagedEmitter<SearchChange>()
|
||||||
.onNext(SearchChange.SearchShortcutEngineSelected(it.engine))
|
.onNext(SearchChange.SearchShortcutEngineSelected(it.engine))
|
||||||
|
|
||||||
|
requireComponents.analytics.metrics.track(Event.SearchShortcutSelected(it.engine.name))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user