For #9488 Add telemetry for search widget CFR
parent
94d741864e
commit
b06be1fcde
|
@ -480,7 +480,6 @@ metrics:
|
||||||
notification_emails:
|
notification_emails:
|
||||||
- fenix-core@mozilla.com
|
- fenix-core@mozilla.com
|
||||||
expires: "2020-09-01"
|
expires: "2020-09-01"
|
||||||
|
|
||||||
toolbar_position:
|
toolbar_position:
|
||||||
type: string
|
type: string
|
||||||
lifetime: application
|
lifetime: application
|
||||||
|
@ -495,7 +494,20 @@ metrics:
|
||||||
notification_emails:
|
notification_emails:
|
||||||
- fenix-core@mozilla.com
|
- fenix-core@mozilla.com
|
||||||
expires: "2020-09-01"
|
expires: "2020-09-01"
|
||||||
|
search_widget_installed:
|
||||||
|
type: boolean
|
||||||
|
lifetime: application
|
||||||
|
description: |
|
||||||
|
Whether or not the search widget is installed
|
||||||
|
send_in_pings:
|
||||||
|
- metrics
|
||||||
|
bugs:
|
||||||
|
- https://github.com/mozilla-mobile/fenix/issues/9488
|
||||||
|
data_reviews:
|
||||||
|
- https://github.com/mozilla-mobile/fenix/pull/10958
|
||||||
|
notification_emails:
|
||||||
|
- fenix-core@mozilla.com
|
||||||
|
expires: "2020-09-01"
|
||||||
|
|
||||||
search.default_engine:
|
search.default_engine:
|
||||||
code:
|
code:
|
||||||
|
@ -1356,6 +1368,53 @@ search_widget:
|
||||||
- fenix-core@mozilla.com
|
- fenix-core@mozilla.com
|
||||||
expires: "2020-09-01"
|
expires: "2020-09-01"
|
||||||
|
|
||||||
|
search_widget_cfr:
|
||||||
|
displayed:
|
||||||
|
type: event
|
||||||
|
description: |
|
||||||
|
The search widget cfr was displayed.
|
||||||
|
bugs:
|
||||||
|
- https://github.com/mozilla-mobile/fenix/issues/9488
|
||||||
|
data_reviews:
|
||||||
|
- https://github.com/mozilla-mobile/fenix/pull/10958
|
||||||
|
notification_emails:
|
||||||
|
- fenix-core@mozilla.com
|
||||||
|
expires: "2020-09-01"
|
||||||
|
add_widget_pressed:
|
||||||
|
type: event
|
||||||
|
description: |
|
||||||
|
The user pressed the "add widget" button.
|
||||||
|
bugs:
|
||||||
|
- https://github.com/mozilla-mobile/fenix/issues/9488
|
||||||
|
data_reviews:
|
||||||
|
- https://github.com/mozilla-mobile/fenix/pull/10958
|
||||||
|
notification_emails:
|
||||||
|
- fenix-core@mozilla.com
|
||||||
|
expires: "2020-09-01"
|
||||||
|
not_now_pressed:
|
||||||
|
type: event
|
||||||
|
description: |
|
||||||
|
The user pressed the "not now" button.
|
||||||
|
bugs:
|
||||||
|
- https://github.com/mozilla-mobile/fenix/issues/9488
|
||||||
|
data_reviews:
|
||||||
|
- https://github.com/mozilla-mobile/fenix/pull/10958
|
||||||
|
notification_emails:
|
||||||
|
- fenix-core@mozilla.com
|
||||||
|
expires: "2020-09-01"
|
||||||
|
canceled:
|
||||||
|
type: event
|
||||||
|
description: |
|
||||||
|
The user dismissed the search widget cfr by
|
||||||
|
tapping outside of the prompt
|
||||||
|
bugs:
|
||||||
|
- https://github.com/mozilla-mobile/fenix/issues/9488
|
||||||
|
data_reviews:
|
||||||
|
- https://github.com/mozilla-mobile/fenix/pull/10958
|
||||||
|
notification_emails:
|
||||||
|
- fenix-core@mozilla.com
|
||||||
|
expires: "2020-09-01"
|
||||||
|
|
||||||
private_browsing_mode:
|
private_browsing_mode:
|
||||||
garbage_icon:
|
garbage_icon:
|
||||||
type: event
|
type: event
|
||||||
|
|
|
@ -53,4 +53,10 @@ object FeatureFlags {
|
||||||
* Enables new voice search feature
|
* Enables new voice search feature
|
||||||
*/
|
*/
|
||||||
val voiceSearch = Config.channel.isNightlyOrDebug
|
val voiceSearch = Config.channel.isNightlyOrDebug
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allows search widget CFR to be displayed.
|
||||||
|
* This is a placeholder for the experimentation framework determining cohorts.
|
||||||
|
*/
|
||||||
|
val searchWidgetCFR = Config.channel.isDebug
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,8 +17,11 @@ import androidx.core.view.marginTop
|
||||||
import kotlinx.android.synthetic.main.search_widget_cfr.view.*
|
import kotlinx.android.synthetic.main.search_widget_cfr.view.*
|
||||||
import kotlinx.android.synthetic.main.tracking_protection_onboarding_popup.view.drop_down_triangle
|
import kotlinx.android.synthetic.main.tracking_protection_onboarding_popup.view.drop_down_triangle
|
||||||
import kotlinx.android.synthetic.main.tracking_protection_onboarding_popup.view.pop_up_triangle
|
import kotlinx.android.synthetic.main.tracking_protection_onboarding_popup.view.pop_up_triangle
|
||||||
|
import org.mozilla.fenix.FeatureFlags
|
||||||
import org.mozilla.fenix.R
|
import org.mozilla.fenix.R
|
||||||
import org.mozilla.fenix.components.SearchWidgetCreator
|
import org.mozilla.fenix.components.SearchWidgetCreator
|
||||||
|
import org.mozilla.fenix.components.metrics.Event
|
||||||
|
import org.mozilla.fenix.ext.components
|
||||||
import org.mozilla.fenix.ext.settings
|
import org.mozilla.fenix.ext.settings
|
||||||
import org.mozilla.fenix.utils.Settings
|
import org.mozilla.fenix.utils.Settings
|
||||||
|
|
||||||
|
@ -30,9 +33,8 @@ class SearchWidgetCFR(
|
||||||
private val getToolbar: () -> View
|
private val getToolbar: () -> View
|
||||||
) {
|
) {
|
||||||
|
|
||||||
// TODO: Based on pref && is in the bucket...?
|
|
||||||
fun displayIfNecessary() {
|
fun displayIfNecessary() {
|
||||||
if (!context.settings().shouldDisplaySearchWidgetCFR()) { return }
|
if (!context.settings().shouldDisplaySearchWidgetCFR() || !FeatureFlags.searchWidgetCFR) { return }
|
||||||
showSearchWidgetCFR()
|
showSearchWidgetCFR()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,15 +59,16 @@ class SearchWidgetCFR(
|
||||||
}
|
}
|
||||||
|
|
||||||
layout.cfr_neg_button.setOnClickListener {
|
layout.cfr_neg_button.setOnClickListener {
|
||||||
|
context.components.analytics.metrics.track(Event.SearchWidgetCFRNotNowPressed)
|
||||||
searchWidgetCFRDialog.dismiss()
|
searchWidgetCFRDialog.dismiss()
|
||||||
context.settings().manuallyDismissSearchWidgetCFR()
|
context.settings().manuallyDismissSearchWidgetCFR()
|
||||||
}
|
}
|
||||||
|
|
||||||
layout.cfr_pos_button.setOnClickListener {
|
layout.cfr_pos_button.setOnClickListener {
|
||||||
//context.components.analytics.metrics.track(Event.)
|
context.components.analytics.metrics.track(Event.SearchWidgetCFRAddWidgetPressed)
|
||||||
SearchWidgetCreator.createSearchWidget(context)
|
SearchWidgetCreator.createSearchWidget(context)
|
||||||
searchWidgetCFRDialog.dismiss()
|
searchWidgetCFRDialog.dismiss()
|
||||||
//context.settings().manuallyDismissSearchWidgetCFR()
|
context.settings().manuallyDismissSearchWidgetCFR()
|
||||||
}
|
}
|
||||||
|
|
||||||
searchWidgetCFRDialog.apply {
|
searchWidgetCFRDialog.apply {
|
||||||
|
@ -81,10 +84,15 @@ class SearchWidgetCFR(
|
||||||
it.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
|
it.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
searchWidgetCFRDialog.setOnCancelListener {
|
||||||
|
context.components.analytics.metrics.track(Event.SearchWidgetCFRCanceled)
|
||||||
|
}
|
||||||
|
|
||||||
searchWidgetCFRDialog.setOnDismissListener {
|
searchWidgetCFRDialog.setOnDismissListener {
|
||||||
context.settings().incrementSearchWidgetCFRDismissed()
|
context.settings().incrementSearchWidgetCFRDismissed()
|
||||||
}
|
}
|
||||||
|
|
||||||
searchWidgetCFRDialog.show()
|
searchWidgetCFRDialog.show()
|
||||||
|
context.components.analytics.metrics.track(Event.SearchWidgetCFRDisplayed)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ import android.os.Build
|
||||||
import org.mozilla.gecko.search.SearchWidgetProvider
|
import org.mozilla.gecko.search.SearchWidgetProvider
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the creation of search widget.
|
* Handles the creation of the pinning search widget dialog.
|
||||||
*/
|
*/
|
||||||
object SearchWidgetCreator {
|
object SearchWidgetCreator {
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,7 @@ import org.mozilla.fenix.GleanMetrics.SearchDefaultEngine
|
||||||
import org.mozilla.fenix.GleanMetrics.SearchShortcuts
|
import org.mozilla.fenix.GleanMetrics.SearchShortcuts
|
||||||
import org.mozilla.fenix.GleanMetrics.SearchSuggestions
|
import org.mozilla.fenix.GleanMetrics.SearchSuggestions
|
||||||
import org.mozilla.fenix.GleanMetrics.SearchWidget
|
import org.mozilla.fenix.GleanMetrics.SearchWidget
|
||||||
|
import org.mozilla.fenix.GleanMetrics.SearchWidgetCfr
|
||||||
import org.mozilla.fenix.GleanMetrics.SyncAccount
|
import org.mozilla.fenix.GleanMetrics.SyncAccount
|
||||||
import org.mozilla.fenix.GleanMetrics.SyncAuth
|
import org.mozilla.fenix.GleanMetrics.SyncAuth
|
||||||
import org.mozilla.fenix.GleanMetrics.Tab
|
import org.mozilla.fenix.GleanMetrics.Tab
|
||||||
|
@ -529,6 +530,19 @@ private val Event.wrapper: EventWrapper<*>?
|
||||||
is Event.VoiceSearchTapped -> EventWrapper<NoExtraKeys>(
|
is Event.VoiceSearchTapped -> EventWrapper<NoExtraKeys>(
|
||||||
{ VoiceSearch.tapped.record(it) }
|
{ VoiceSearch.tapped.record(it) }
|
||||||
)
|
)
|
||||||
|
is Event.SearchWidgetCFRDisplayed -> EventWrapper<NoExtraKeys>(
|
||||||
|
{ SearchWidgetCfr.displayed.record(it) }
|
||||||
|
)
|
||||||
|
is Event.SearchWidgetCFRCanceled -> EventWrapper<NoExtraKeys>(
|
||||||
|
{ SearchWidgetCfr.canceled.record(it) }
|
||||||
|
)
|
||||||
|
is Event.SearchWidgetCFRNotNowPressed -> EventWrapper<NoExtraKeys>(
|
||||||
|
{ SearchWidgetCfr.notNowPressed.record(it) }
|
||||||
|
)
|
||||||
|
is Event.SearchWidgetCFRAddWidgetPressed -> EventWrapper<NoExtraKeys>(
|
||||||
|
{ SearchWidgetCfr.addWidgetPressed.record(it) }
|
||||||
|
)
|
||||||
|
|
||||||
// Don't record other events in Glean:
|
// Don't record other events in Glean:
|
||||||
is Event.AddBookmark -> null
|
is Event.AddBookmark -> null
|
||||||
is Event.OpenedBookmark -> null
|
is Event.OpenedBookmark -> null
|
||||||
|
@ -584,6 +598,9 @@ class GleanMetricsService(private val context: Context) : MetricsService {
|
||||||
adjustAdGroup.set(context.settings().adjustAdGroup)
|
adjustAdGroup.set(context.settings().adjustAdGroup)
|
||||||
adjustCreative.set(context.settings().adjustCreative)
|
adjustCreative.set(context.settings().adjustCreative)
|
||||||
adjustNetwork.set(context.settings().adjustNetwork)
|
adjustNetwork.set(context.settings().adjustNetwork)
|
||||||
|
|
||||||
|
searchWidgetInstalled.set(context.settings().searchWidgetInstalled)
|
||||||
|
|
||||||
val topSitesSize = context.settings().topSitesSize
|
val topSitesSize = context.settings().topSitesSize
|
||||||
hasTopSites.set(topSitesSize > 0)
|
hasTopSites.set(topSitesSize > 0)
|
||||||
if (topSitesSize > 0) {
|
if (topSitesSize > 0) {
|
||||||
|
|
|
@ -168,6 +168,10 @@ sealed class Event {
|
||||||
object AddonsOpenInSettings : Event()
|
object AddonsOpenInSettings : Event()
|
||||||
object AddonsOpenInToolbarMenu : Event()
|
object AddonsOpenInToolbarMenu : Event()
|
||||||
object VoiceSearchTapped : Event()
|
object VoiceSearchTapped : Event()
|
||||||
|
object SearchWidgetCFRDisplayed : Event()
|
||||||
|
object SearchWidgetCFRCanceled : Event()
|
||||||
|
object SearchWidgetCFRNotNowPressed : Event()
|
||||||
|
object SearchWidgetCFRAddWidgetPressed : Event()
|
||||||
|
|
||||||
// Interaction events with extras
|
// Interaction events with extras
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,7 @@ class DefaultSearchController(
|
||||||
val event = if (url.isUrl()) {
|
val event = if (url.isUrl()) {
|
||||||
Event.EnteredUrl(false)
|
Event.EnteredUrl(false)
|
||||||
} else {
|
} else {
|
||||||
context.settings().incrementActiveSearchCount()
|
activity.settings().incrementActiveSearchCount()
|
||||||
|
|
||||||
val searchAccessPoint = when (store.state.searchAccessPoint) {
|
val searchAccessPoint = when (store.state.searchAccessPoint) {
|
||||||
NONE -> ACTION
|
NONE -> ACTION
|
||||||
|
@ -144,7 +144,7 @@ class DefaultSearchController(
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun handleSearchTermsTapped(searchTerms: String) {
|
override fun handleSearchTermsTapped(searchTerms: String) {
|
||||||
context.settings().incrementActiveSearchCount()
|
activity.settings().incrementActiveSearchCount()
|
||||||
|
|
||||||
activity.openToBrowserAndLoad(
|
activity.openToBrowserAndLoad(
|
||||||
searchTermOrURL = searchTerms,
|
searchTermOrURL = searchTerms,
|
||||||
|
|
|
@ -55,6 +55,7 @@ class Settings private constructor(
|
||||||
const val trackingProtectionOnboardingMaximumCount = 1
|
const val trackingProtectionOnboardingMaximumCount = 1
|
||||||
const val FENIX_PREFERENCES = "fenix_preferences"
|
const val FENIX_PREFERENCES = "fenix_preferences"
|
||||||
|
|
||||||
|
private const val showSearchWidgetCFRMaxCount = 3
|
||||||
private const val BLOCKED_INT = 0
|
private const val BLOCKED_INT = 0
|
||||||
private const val ASK_TO_ALLOW_INT = 1
|
private const val ASK_TO_ALLOW_INT = 1
|
||||||
private const val ALLOWED_INT = 2
|
private const val ALLOWED_INT = 2
|
||||||
|
@ -166,7 +167,7 @@ class Settings private constructor(
|
||||||
|
|
||||||
fun shouldDisplaySearchWidgetCFR(): Boolean =
|
fun shouldDisplaySearchWidgetCFR(): Boolean =
|
||||||
isActiveSearcher &&
|
isActiveSearcher &&
|
||||||
searchWidgetCFRDismissCount < 3 &&
|
searchWidgetCFRDismissCount < showSearchWidgetCFRMaxCount &&
|
||||||
!searchWidgetInstalled &&
|
!searchWidgetInstalled &&
|
||||||
!searchWidgetCFRManuallyDismissed
|
!searchWidgetCFRManuallyDismissed
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
<string name="cfr_neg_button_text">No thanks</string>
|
<string name="cfr_neg_button_text">No thanks</string>
|
||||||
|
|
||||||
<!-- Search widget "contextual feature recommendation" (CFR) -->
|
<!-- Search widget "contextual feature recommendation" (CFR) -->
|
||||||
<!-- Text for the main message. Placeholder text replaced with app name. -->
|
<!-- Text for the main message. 'Firefox' intentionally hardcoded here.-->
|
||||||
<string name="search_widget_cfr_message">Get to Firefox faster. Add a widget to your Home screen.</string>
|
<string name="search_widget_cfr_message">Get to Firefox faster. Add a widget to your Home screen.</string>
|
||||||
<!-- Text for the positive button -->
|
<!-- Text for the positive button -->
|
||||||
<string name="search_widget_cfr_pos_button_text">Add widget</string>
|
<string name="search_widget_cfr_pos_button_text">Add widget</string>
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue