1
0
Fork 0

For #4457: Adds telemetry for search widget actions (#4714)

master
Yeon Taek Jeong 2019-08-14 11:39:54 -07:00 committed by GitHub
parent 2f265eccbd
commit f5ffe3734c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 66 additions and 5 deletions

View File

@ -1115,6 +1115,31 @@ collections:
- fenix-core@mozilla.com
expires: "2020-03-01"
search_widget:
new_tab_button:
type: event
description: >
A user pressed anywhere from the Firefox logo until the start of the microphone icon, opening a
new tab search screen.
bugs:
- 4457
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/4714
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"
voice_button:
type: event
description: >
A user pressed the microphone icon, opening a new voice search screen.
bugs:
- 4457
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/4714
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"
experiments.metrics:
active_experiment:
type: string
@ -1130,4 +1155,4 @@ experiments.metrics:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1543986#c4
notification_emails:
- mcooper@mozilla.com
expires: 2019-11-01
expires: 2019-11-01

View File

@ -189,6 +189,7 @@ open class HomeActivity : AppCompatActivity(), ShareFragment.TabsSharedCallback
return
} else if (intent?.extras?.getBoolean(OPEN_TO_SEARCH) == true) {
this.intent.putExtra(OPEN_TO_SEARCH, false)
components.analytics.metrics.track(Event.SearchWidgetNewTabPressed)
navHost.navController.nav(null, NavGraphDirections.actionGlobalSearch(null))
return
}

View File

@ -10,9 +10,11 @@ import android.os.Bundle
import android.speech.RecognizerIntent
import kotlinx.coroutines.MainScope
import kotlinx.coroutines.launch
import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.customtabs.AuthCustomTabActivity
import org.mozilla.fenix.customtabs.CustomTabActivity
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.metrics
import org.mozilla.fenix.utils.Settings
class IntentReceiverActivity : Activity() {
@ -94,7 +96,7 @@ class IntentReceiverActivity : Activity() {
val intentSpeech = Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH).apply {
putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM)
}
this.metrics.track(Event.SearchWidgetVoiceSearchPressed)
startActivityForResult(intentSpeech, SPEECH_REQUEST_CODE)
}

View File

@ -16,6 +16,7 @@ import mozilla.components.service.glean.config.Configuration
import mozilla.components.service.glean.private.NoExtraKeys
import mozilla.components.support.utils.Browsers
import org.mozilla.fenix.GleanMetrics.BookmarksManagement
import org.mozilla.fenix.GleanMetrics.Collections
import org.mozilla.fenix.GleanMetrics.ContextMenu
import org.mozilla.fenix.GleanMetrics.CrashReporter
import org.mozilla.fenix.GleanMetrics.CustomTab
@ -28,12 +29,12 @@ import org.mozilla.fenix.GleanMetrics.Metrics
import org.mozilla.fenix.GleanMetrics.Pings
import org.mozilla.fenix.GleanMetrics.QrScanner
import org.mozilla.fenix.GleanMetrics.QuickActionSheet
import org.mozilla.fenix.GleanMetrics.SearchDefaultEngine
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.GleanMetrics.Collections
import org.mozilla.fenix.GleanMetrics.ReaderMode
import org.mozilla.fenix.GleanMetrics.SearchDefaultEngine
import org.mozilla.fenix.GleanMetrics.SearchWidget
import org.mozilla.fenix.GleanMetrics.SyncAccount
import org.mozilla.fenix.GleanMetrics.SyncAuth
import org.mozilla.fenix.ext.components
private class EventWrapper<T : Enum<T>>(
private val recorder: ((Map<T, String>?) -> Unit),
@ -293,6 +294,12 @@ private val Event.wrapper
{ Collections.tabsAdded.record(it) },
{ Collections.tabsAddedKeys.valueOf(it) }
)
is Event.SearchWidgetNewTabPressed -> EventWrapper<NoExtraKeys>(
{ SearchWidget.newTabButton.record(it) }
)
is Event.SearchWidgetVoiceSearchPressed -> EventWrapper<NoExtraKeys>(
{ SearchWidget.voiceButton.record(it) }
)
// Don't track other events with Glean
else -> null

View File

@ -112,6 +112,8 @@ sealed class Event {
object CollectionTabLongPressed : Event()
object CollectionAddTabPressed : Event()
object CollectionRenamePressed : Event()
object SearchWidgetNewTabPressed : Event()
object SearchWidgetVoiceSearchPressed : Event()
data class PreferenceToggled(val preferenceKey: String, val enabled: Boolean, val context: Context) : Event() {
private val switchPreferenceTelemetryAllowList = listOf(

View File

@ -1067,3 +1067,27 @@ Data that is sent in the activation ping
</tr>
</table>
</pre>
## search_widget
<pre>
<table style="width: 100%">
<tr>
<td>new_tab_button</td>
<td>event</td>
<td>A user pressed anywhere from the Firefox logo until the start of the microphone icon, opening a
new tab search screen.</td>
<td><a href="https://github.com/mozilla-mobile/fenix/pull/4714">link</a></td>
<td></td>
<td>2020-03-01</td>
</tr>
<tr>
<td>voice_button</td>
<td>event</td>
<td>A user pressed the microphone icon, opening a new voice search screen.</td>
<td><a href="https://github.com/mozilla-mobile/fenix/pull/4714">link</a></td>
<td></td>
<td>2020-03-01</td>
</tr>
</table>
</pre>