Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Commit

Permalink
For #800 - Adds metrics for the default search engine
Browse files Browse the repository at this point in the history
  • Loading branch information
boek committed Apr 12, 2019
1 parent bc1b7e0 commit a2482cc
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 1 deletion.
40 changes: 39 additions & 1 deletion app/metrics.yaml
Expand Up @@ -326,4 +326,42 @@ metrics:
notification_emails:
- telemetry-client-dev@mozilla.com
- fenix-core@mozilla.com
expires: "2020-03-01"
expires: "2020-03-01"

search.default_engine:
code:
type: string
description: The search code for the search engine
send_in_pings:
- metrics
bugs:
- 800
data_reviews:
- TBD
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"
name:
type: string
description: The name of the search engine
send_in_pings:
- metrics
bugs:
- 800
data_reviews:
- TBD
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"
submission_url:
type: string
description: The full url we use to query the serach engine
send_in_pings:
- metrics
bugs:
- 800
data_reviews:
- TBD
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"
Expand Up @@ -13,6 +13,8 @@ import org.mozilla.fenix.GleanMetrics.FindInPage
import org.mozilla.fenix.GleanMetrics.ContextMenu
import org.mozilla.fenix.GleanMetrics.QuickActionSheet
import org.mozilla.fenix.GleanMetrics.Metrics
import org.mozilla.fenix.GleanMetrics.SearchDefaultEngine
import org.mozilla.fenix.ext.components

private class EventWrapper<T : Enum<T>>(
private val recorder: ((Map<T, String>?) -> Unit),
Expand Down Expand Up @@ -119,6 +121,19 @@ class GleanMetricsService(private val context: Context) : MetricsService {
defaultBrowser.set(Browsers.all(context).isDefaultBrowser)
}

SearchDefaultEngine.apply {
val defaultEngine = context
.components
.search
.searchEngineManager
.defaultSearchEngine ?: return@apply

code.set(defaultEngine.identifier)
name.set(defaultEngine.name)
submissionUrl.set(defaultEngine.buildSearchUrl(""))
}


initialized = true
}

Expand Down

0 comments on commit a2482cc

Please sign in to comment.