diff --git a/app/metrics.yaml b/app/metrics.yaml index 53fd5feb7..19e326590 100644 --- a/app/metrics.yaml +++ b/app/metrics.yaml @@ -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 \ No newline at end of file + expires: 2019-11-01 diff --git a/app/src/main/java/org/mozilla/fenix/HomeActivity.kt b/app/src/main/java/org/mozilla/fenix/HomeActivity.kt index f3a1cadfe..5d59de5e9 100644 --- a/app/src/main/java/org/mozilla/fenix/HomeActivity.kt +++ b/app/src/main/java/org/mozilla/fenix/HomeActivity.kt @@ -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 } diff --git a/app/src/main/java/org/mozilla/fenix/IntentReceiverActivity.kt b/app/src/main/java/org/mozilla/fenix/IntentReceiverActivity.kt index 5628dd0ce..90b1db780 100644 --- a/app/src/main/java/org/mozilla/fenix/IntentReceiverActivity.kt +++ b/app/src/main/java/org/mozilla/fenix/IntentReceiverActivity.kt @@ -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) } diff --git a/app/src/main/java/org/mozilla/fenix/components/metrics/GleanMetricsService.kt b/app/src/main/java/org/mozilla/fenix/components/metrics/GleanMetricsService.kt index 308738239..3d250cf75 100644 --- a/app/src/main/java/org/mozilla/fenix/components/metrics/GleanMetricsService.kt +++ b/app/src/main/java/org/mozilla/fenix/components/metrics/GleanMetricsService.kt @@ -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>( private val recorder: ((Map?) -> Unit), @@ -293,6 +294,12 @@ private val Event.wrapper { Collections.tabsAdded.record(it) }, { Collections.tabsAddedKeys.valueOf(it) } ) + is Event.SearchWidgetNewTabPressed -> EventWrapper( + { SearchWidget.newTabButton.record(it) } + ) + is Event.SearchWidgetVoiceSearchPressed -> EventWrapper( + { SearchWidget.voiceButton.record(it) } + ) // Don't track other events with Glean else -> null diff --git a/app/src/main/java/org/mozilla/fenix/components/metrics/Metrics.kt b/app/src/main/java/org/mozilla/fenix/components/metrics/Metrics.kt index 7c2deaab2..df0f61d09 100644 --- a/app/src/main/java/org/mozilla/fenix/components/metrics/Metrics.kt +++ b/app/src/main/java/org/mozilla/fenix/components/metrics/Metrics.kt @@ -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( diff --git a/docs/metrics.md b/docs/metrics.md index 87b50cff5..3fa0305f9 100644 --- a/docs/metrics.md +++ b/docs/metrics.md @@ -1067,3 +1067,27 @@ Data that is sent in the activation ping + +## search_widget + +
+
+    
+        
+        
+        
+        
+        
+        
+    
+    
+        
+        
+        
+        
+        
+        
+    
+
new_tab_buttoneventA user pressed anywhere from the Firefox logo until the start of the microphone icon, opening a + new tab search screen.link2020-03-01
voice_buttoneventA user pressed the microphone icon, opening a new voice search screen.link2020-03-01
+
\ No newline at end of file