1
0
Fork 0

For #5884: Adds user-specified search engines telemetry

Created events for adding and deleting a custom search engine and for searches
performed with a custom search engine.
master
ValentinTimisica 2019-12-03 15:54:57 +02:00 committed by Jeff Boek
parent cf220427d7
commit 7c5c9355ce
7 changed files with 80 additions and 1 deletions

View File

@ -1658,6 +1658,41 @@ download_notification:
- fenix-core@mozilla.com
expires: "2020-03-01"
user_specified_search_engines:
custom_engine_added:
type: event
description: >
A user added a new custom search engine
bugs:
- https://github.com/mozilla-mobile/fenix/issues/5884
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/6918
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"
custom_engine_deleted:
type: event
description: >
A user deleted a custom search engine
bugs:
- https://github.com/mozilla-mobile/fenix/issues/5586
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/6918
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"
search_with_custom_engine:
type: event
description: >
A user performed a search with a custom search engine
bugs:
- https://github.com/mozilla-mobile/fenix/issues/5586
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/6918
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"
search_suggestions:
enable_in_private:
type: event
@ -1669,4 +1704,4 @@ search_suggestions:
- https://github.com/mozilla-mobile/fenix/pull/6746
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"
expires: "2020-03-01"

View File

@ -42,6 +42,7 @@ import org.mozilla.fenix.GleanMetrics.SyncAuth
import org.mozilla.fenix.GleanMetrics.Tab
import org.mozilla.fenix.GleanMetrics.ToolbarSettings
import org.mozilla.fenix.GleanMetrics.TrackingProtection
import org.mozilla.fenix.GleanMetrics.UserSpecifiedSearchEngines
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.settings
import org.mozilla.fenix.utils.BrowsersCache
@ -454,6 +455,15 @@ private val Event.wrapper: EventWrapper<*>?
{ ToolbarSettings.changedPosition.record(it) },
{ ToolbarSettings.changedPositionKeys.valueOf(it) }
)
is Event.CustomEngineAdded -> EventWrapper<NoExtraKeys>(
{ UserSpecifiedSearchEngines.customEngineAdded.record(it) }
)
is Event.CustomEngineDeleted -> EventWrapper<NoExtraKeys>(
{ UserSpecifiedSearchEngines.customEngineDeleted.record(it) }
)
is Event.SearchWithCustomEngine -> EventWrapper<NoExtraKeys>(
{ UserSpecifiedSearchEngines.searchWithCustomEngine.record(it) }
)
// Don't record other events in Glean:
is Event.AddBookmark -> null
is Event.OpenedBookmark -> null

View File

@ -137,6 +137,9 @@ sealed class Event {
object OpenOneLogin : Event()
object CopyLogin : Event()
object ViewLoginPassword : Event()
object CustomEngineAdded : Event()
object CustomEngineDeleted : Event()
object SearchWithCustomEngine : Event()
object PrivateBrowsingShowSearchSuggestions : Event()
// Interaction events with extras

View File

@ -58,6 +58,13 @@ class DefaultSearchController(
}
context.metrics.track(event)
if (CustomSearchEngineStore.isCustomSearchEngine(
context,
store.state.searchEngineSource.searchEngine.identifier
)
) {
context.components.analytics.metrics.track(Event.SearchWithCustomEngine)
}
}
}
@ -86,6 +93,13 @@ class DefaultSearchController(
)
context.metrics.track(Event.EnteredUrl(false))
if (CustomSearchEngineStore.isCustomSearchEngine(
context,
store.state.searchEngineSource.searchEngine.identifier
)
) {
context.components.analytics.metrics.track(Event.SearchWithCustomEngine)
}
}
override fun handleSearchTermsTapped(searchTerms: String) {
@ -99,6 +113,13 @@ class DefaultSearchController(
val event = createSearchEvent(store.state.searchEngineSource.searchEngine, true)
context.metrics.track(event)
if (CustomSearchEngineStore.isCustomSearchEngine(
context,
store.state.searchEngineSource.searchEngine.identifier
)
) {
context.components.analytics.metrics.track(Event.SearchWithCustomEngine)
}
}
override fun handleSearchShortcutEngineSelected(searchEngine: SearchEngine) {

View File

@ -30,6 +30,7 @@ import kotlinx.coroutines.withContext
import mozilla.components.browser.search.SearchEngine
import org.mozilla.fenix.R
import org.mozilla.fenix.components.FenixSnackbar
import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.components.searchengine.CustomSearchEngineStore
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.increaseTapArea
@ -211,6 +212,7 @@ class AddSearchEngineFragment : Fragment(), CompoundButton.OnCheckedChangeListen
.show()
}
context?.components?.analytics?.metrics?.track(Event.CustomEngineAdded)
findNavController().popBackStack()
}
}

View File

@ -23,6 +23,7 @@ import kotlinx.coroutines.MainScope
import mozilla.components.browser.search.SearchEngine
import mozilla.components.browser.search.provider.SearchEngineList
import org.mozilla.fenix.R
import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.components.searchengine.CustomSearchEngineStore
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.getRootView
@ -191,6 +192,10 @@ abstract class SearchEngineListPreference @JvmOverloads constructor(
.getDefaultEngine(context)
.name
}
if (CustomSearchEngineStore.isCustomSearchEngine(context, engine.identifier)) {
context.components.analytics.metrics.track(Event.CustomEngineDeleted)
}
refreshSearchEngineViews(context)
}
)

View File

@ -156,6 +156,9 @@ The following metrics are added to the ping:
| tracking_protection.etp_tracker_list |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user pressed into a list of categorized trackers in tracking protection panel. |[1](https://github.com/mozilla-mobile/fenix/pull/5414#issuecomment-532847188)||2020-03-01 |
| tracking_protection.exception_added |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user added a tracking protection exception through the TP toggle in the panel. |[1](https://github.com/mozilla-mobile/fenix/pull/5414#issuecomment-532847188)||2020-03-01 |
| tracking_protection.panel_settings |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user opened tracking protection settings from the panel. |[1](https://github.com/mozilla-mobile/fenix/pull/5414#issuecomment-532847188)||2020-03-01 |
| user_specified_search_engines.custom_engine_added |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user added a new custom search engine |[1](https://github.com/mozilla-mobile/fenix/pull/6918)||2020-03-01 |
| user_specified_search_engines.custom_engine_deleted |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user deleted a custom search engine |[1](https://github.com/mozilla-mobile/fenix/pull/6918)||2020-03-01 |
| user_specified_search_engines.search_with_custom_engine |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user performed a search with a custom search engine |[1](https://github.com/mozilla-mobile/fenix/pull/6918)||2020-03-01 |
## metrics
This is a built-in ping that is assembled out of the box by the Glean SDK.