1
0
Fork 0

#10824: Onboarding telemetry (#11867)

* Onboarding events and tracking

* Rename metrics for consistency

* Add reference to PR for the data review

* Add default values to onboarding events
master
Elise Richards 2020-06-25 13:21:31 -05:00 committed by GitHub
parent 932a032772
commit 665fb8d60c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 246 additions and 6 deletions

View File

@ -205,6 +205,131 @@ events:
- fenix-core@mozilla.com
expires: "2020-09-01"
onboarding:
fxa_auto_signin:
type: event
description:
The onboarding automatic sign in card was tapped.
bugs:
- https://github.com/mozilla-mobile/fenix/issues/10824
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/11867
notification_emails:
- fenix-core@mozilla.com
- erichards@mozilla.com
expires: "2020-09-01"
fxa_manual_signin:
type: event
description:
The onboarding manual sign in card was tapped.
bugs:
- https://github.com/mozilla-mobile/fenix/issues/10824
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/11867
notification_emails:
- fenix-core@mozilla.com
- erichards@mozilla.com
expires: "2020-09-01"
privacy_notice:
type: event
description:
The onboarding privacy notice card was tapped.
bugs:
- https://github.com/mozilla-mobile/fenix/issues/10824
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/11867
notification_emails:
- fenix-core@mozilla.com
- erichards@mozilla.com
expires: "2020-09-01"
pref_toggled_private_browsing:
type: event
description:
The private browsing preference was selected from the onboarding card.
bugs:
- https://github.com/mozilla-mobile/fenix/issues/10824
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/11867
notification_emails:
- fenix-core@mozilla.com
- erichards@mozilla.com
expires: "2020-09-01"
pref_toggled_toolbar_position:
type: event
description:
The toolbar position preference was chosen from the onboarding card.
extra_keys:
position:
description: |
A string that indicates the position of the toolbar TOP or BOTTOM.
Default: BOTTOM
bugs:
- https://github.com/mozilla-mobile/fenix/issues/10824
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/11867
notification_emails:
- fenix-core@mozilla.com
- erichards@mozilla.com
expires: "2020-09-01"
pref_toggled_tracking_prot:
type: event
description:
The tracking protection preference was chosen from the onboarding card.
extra_keys:
position:
description: |
A string that indicates the Tracking Protection policy STANDARD
or STRICT. Default: Toggle ON, STANDARD
bugs:
- https://github.com/mozilla-mobile/fenix/issues/10824
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/11867
notification_emails:
- fenix-core@mozilla.com
- erichards@mozilla.com
expires: "2020-09-01"
whats_new:
type: event
description:
The onboarding What\'s New card was tapped.
bugs:
- https://github.com/mozilla-mobile/fenix/issues/10824
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/11867
notification_emails:
- fenix-core@mozilla.com
- erichards@mozilla.com
expires: "2020-09-01"
pref_toggled_theme_picker:
type: event
description:
The device theme was chosen using the theme picker onboarding card.
extra_keys:
theme:
description: |
A string that indicates the theme LIGHT, DARK, or FOLLOW DEVICE.
Default: FOLLOW DEVICE
bugs:
- https://github.com/mozilla-mobile/fenix/issues/10824
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/11867
notification_emails:
- fenix-core@mozilla.com
- erichards@mozilla.com
expires: "2020-09-01"
finish:
type: event
description:
The user taps starts browsing and ends the onboarding experience.
bugs:
- https://github.com/mozilla-mobile/fenix/issues/10824
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/11867
notification_emails:
- fenix-core@mozilla.com
- erichards@mozilla.com
expires: "2020-09-01"
search_shortcuts:
selected:
type: event

View File

@ -21,6 +21,7 @@ import org.mozilla.fenix.GleanMetrics.CustomTab
import org.mozilla.fenix.GleanMetrics.DownloadNotification
import org.mozilla.fenix.GleanMetrics.ErrorPage
import org.mozilla.fenix.GleanMetrics.Events
import org.mozilla.fenix.GleanMetrics.Events.preferenceToggled
import org.mozilla.fenix.GleanMetrics.FindInPage
import org.mozilla.fenix.GleanMetrics.History
import org.mozilla.fenix.GleanMetrics.Logins
@ -29,6 +30,7 @@ import org.mozilla.fenix.GleanMetrics.MediaState
import org.mozilla.fenix.GleanMetrics.Metrics
import org.mozilla.fenix.GleanMetrics.Pings
import org.mozilla.fenix.GleanMetrics.Pocket
import org.mozilla.fenix.GleanMetrics.Onboarding
import org.mozilla.fenix.GleanMetrics.Preferences
import org.mozilla.fenix.GleanMetrics.PrivateBrowsingMode
import org.mozilla.fenix.GleanMetrics.PrivateBrowsingShortcut
@ -552,6 +554,36 @@ private val Event.wrapper: EventWrapper<*>?
{ Events.tabCounterMenuAction.record(it) },
{ Events.tabCounterMenuActionKeys.valueOf(it) }
)
is Event.OnboardingWhatsNew -> EventWrapper<NoExtraKeys>(
{ Onboarding.whatsNew.record(it) }
)
is Event.OnboardingPrivateBrowsing -> EventWrapper<NoExtraKeys>(
{ Onboarding.prefToggledPrivateBrowsing.record(it) }
)
is Event.OnboardingPrivacyNotice -> EventWrapper<NoExtraKeys>(
{ Onboarding.privacyNotice.record(it) }
)
is Event.OnboardingManualSignIn -> EventWrapper<NoExtraKeys>(
{ Onboarding.fxaManualSignin.record(it) }
)
is Event.OnboardingAutoSignIn -> EventWrapper<NoExtraKeys>(
{ Onboarding.fxaAutoSignin.record(it) }
)
is Event.OnboardingFinish -> EventWrapper<NoExtraKeys>(
{ Onboarding.finish.record(it) }
)
is Event.OnboardingTrackingProtection -> EventWrapper(
{ Onboarding.prefToggledTrackingProt.record(it) },
{ Onboarding.prefToggledTrackingProtKeys.valueOf(it) }
)
is Event.OnboardingThemePicker -> EventWrapper(
{ Onboarding.prefToggledThemePicker.record(it) },
{ Onboarding.prefToggledThemePickerKeys.valueOf(it) }
)
is Event.OnboardingToolbarPosition -> EventWrapper(
{ Onboarding.prefToggledToolbarPosition.record(it) },
{ Onboarding.prefToggledToolbarPositionKeys.valueOf(it) }
)
// Don't record other events in Glean:
is Event.AddBookmark -> null

View File

@ -172,8 +172,34 @@ sealed class Event {
object SearchWidgetCFRCanceled : Event()
object SearchWidgetCFRNotNowPressed : Event()
object SearchWidgetCFRAddWidgetPressed : Event()
object OnboardingAutoSignIn : Event()
object OnboardingManualSignIn : Event()
object OnboardingPrivacyNotice : Event()
object OnboardingPrivateBrowsing : Event()
object OnboardingWhatsNew : Event()
object OnboardingFinish : Event()
// Interaction events with extras
data class OnboardingToolbarPosition(val position: Position) : Event() {
enum class Position { TOP, BOTTOM }
override val extras: Map<ToolbarSettings.changedPositionKeys, String>?
get() = hashMapOf(ToolbarSettings.changedPositionKeys.position to position.name)
}
data class OnboardingTrackingProtection(val setting: Setting) : Event() {
enum class Setting { STRICT, STANDARD }
override val extras: Map<TrackingProtection.etpSettingChangedKeys, String>?
get() = hashMapOf(TrackingProtection.etpSettingChangedKeys.etpSetting to setting.name)
}
data class OnboardingThemePicker(val theme: Theme) : Event() {
enum class Theme { LIGHT, DARK, FOLLOW_DEVICE }
override val extras: Map<AppTheme.darkThemeSelectedKeys, String>?
get() = mapOf(AppTheme.darkThemeSelectedKeys.source to theme.name)
}
data class PreferenceToggled(
val preferenceKey: String,
@ -371,7 +397,7 @@ sealed class Event {
}
data class DarkThemeSelected(val source: Source) : Event() {
enum class Source { SETTINGS, ONBOARDING }
enum class Source { SETTINGS }
override val extras: Map<AppTheme.darkThemeSelectedKeys, String>?
get() = mapOf(AppTheme.darkThemeSelectedKeys.source to source.name)

View File

@ -17,6 +17,7 @@ import mozilla.components.service.fxa.sharing.ShareableAccount
import mozilla.components.support.ktx.android.view.putCompoundDrawablesRelativeWithIntrinsicBounds
import org.mozilla.fenix.R
import org.mozilla.fenix.components.FenixSnackbar
import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.ext.components
class OnboardingAutomaticSignInViewHolder(view: View) : RecyclerView.ViewHolder(view) {
@ -26,6 +27,8 @@ class OnboardingAutomaticSignInViewHolder(view: View) : RecyclerView.ViewHolder(
init {
view.turn_on_sync_button.setOnClickListener {
it.context.components.analytics.metrics.track(Event.OnboardingAutoSignIn)
it.turn_on_sync_button.text = it.context.getString(
R.string.onboarding_firefox_account_signing_in
)

View File

@ -8,6 +8,8 @@ import android.view.View
import androidx.recyclerview.widget.RecyclerView
import kotlinx.android.synthetic.main.onboarding_finish.view.*
import org.mozilla.fenix.R
import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.home.sessioncontrol.OnboardingInteractor
class OnboardingFinishViewHolder(
@ -18,6 +20,7 @@ class OnboardingFinishViewHolder(
init {
view.finish_button.setOnClickListener {
interactor.onStartBrowsingClicked()
it.context.components.analytics.metrics.track(Event.OnboardingFinish)
}
}

View File

@ -12,6 +12,8 @@ import androidx.recyclerview.widget.RecyclerView
import kotlinx.android.synthetic.main.onboarding_manual_signin.view.*
import mozilla.components.support.ktx.android.view.putCompoundDrawablesRelativeWithIntrinsicBounds
import org.mozilla.fenix.R
import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.home.HomeFragmentDirections
class OnboardingManualSignInViewHolder(view: View) : RecyclerView.ViewHolder(view) {
@ -20,6 +22,8 @@ class OnboardingManualSignInViewHolder(view: View) : RecyclerView.ViewHolder(vie
init {
view.turn_on_sync_button.setOnClickListener {
it.context.components.analytics.metrics.track(Event.OnboardingManualSignIn)
val directions = HomeFragmentDirections.actionGlobalTurnOnSync()
Navigation.findNavController(view).navigate(directions)
}

View File

@ -8,6 +8,8 @@ import android.view.View
import androidx.recyclerview.widget.RecyclerView
import kotlinx.android.synthetic.main.onboarding_privacy_notice.view.*
import org.mozilla.fenix.R
import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.home.sessioncontrol.OnboardingInteractor
class OnboardingPrivacyNoticeViewHolder(
@ -22,6 +24,7 @@ class OnboardingPrivacyNoticeViewHolder(
view.description_text.text = view.context.getString(R.string.onboarding_privacy_notice_description, appName)
view.read_button.setOnClickListener {
it.context.components.analytics.metrics.track(Event.OnboardingPrivacyNotice)
interactor.onReadPrivacyNoticeClicked()
}
}

View File

@ -16,6 +16,8 @@ import androidx.appcompat.content.res.AppCompatResources
import androidx.recyclerview.widget.RecyclerView
import kotlinx.android.synthetic.main.onboarding_private_browsing.view.*
import org.mozilla.fenix.R
import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.setBounds
import org.mozilla.fenix.home.sessioncontrol.OnboardingInteractor
@ -47,6 +49,7 @@ class OnboardingPrivateBrowsingViewHolder(
view.description_text_once.text = text
view.description_text_once.contentDescription = String.format(text.toString(), view.header_text.text)
view.open_settings_button.setOnClickListener {
it.context.components.analytics.metrics.track(Event.OnboardingPrivateBrowsing)
interactor.onOpenSettingsClicked()
}
}

View File

@ -17,6 +17,7 @@ import kotlinx.android.synthetic.main.onboarding_theme_picker.view.theme_light_i
import kotlinx.android.synthetic.main.onboarding_theme_picker.view.theme_light_radio_button
import org.mozilla.fenix.R
import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.components.metrics.Event.OnboardingThemePicker.Theme
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.settings
import org.mozilla.fenix.onboarding.OnboardingRadioButton
@ -46,10 +47,12 @@ class OnboardingThemePickerViewHolder(view: View) : RecyclerView.ViewHolder(view
radioFollowDeviceTheme.addToRadioGroup(radioLightTheme)
view.theme_dark_image.setOnClickListener {
it.context.components.analytics.metrics.track(Event.OnboardingThemePicker(Theme.DARK))
radioDarkTheme.performClick()
}
view.theme_light_image.setOnClickListener {
it.context.components.analytics.metrics.track(Event.OnboardingThemePicker(Theme.LIGHT))
radioLightTheme.performClick()
}
@ -58,23 +61,26 @@ class OnboardingThemePickerViewHolder(view: View) : RecyclerView.ViewHolder(view
view.clickable_region_automatic.contentDescription = "$automaticTitle $automaticSummary"
view.clickable_region_automatic.setOnClickListener {
it.context.components.analytics.metrics
.track(Event.OnboardingThemePicker(Theme.FOLLOW_DEVICE))
radioFollowDeviceTheme.performClick()
}
radioLightTheme.onClickListener {
view.context.components.analytics.metrics
.track(Event.OnboardingThemePicker(Theme.LIGHT))
setNewTheme(AppCompatDelegate.MODE_NIGHT_NO)
}
radioDarkTheme.onClickListener {
view.context.components.analytics.metrics.track(
Event.DarkThemeSelected(
Event.DarkThemeSelected.Source.ONBOARDING
)
)
view.context.components.analytics.metrics
.track(Event.OnboardingThemePicker(Theme.DARK))
setNewTheme(AppCompatDelegate.MODE_NIGHT_YES)
}
radioFollowDeviceTheme.onClickListener {
view.context.components.analytics.metrics
.track(Event.OnboardingThemePicker(Theme.FOLLOW_DEVICE))
if (SDK_INT >= Build.VERSION_CODES.P) {
setNewTheme(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM)
} else {

View File

@ -11,7 +11,10 @@ import kotlinx.android.synthetic.main.onboarding_toolbar_position_picker.view.to
import kotlinx.android.synthetic.main.onboarding_toolbar_position_picker.view.toolbar_top_image
import kotlinx.android.synthetic.main.onboarding_toolbar_position_picker.view.toolbar_top_radio_button
import org.mozilla.fenix.R
import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.components.metrics.Event.OnboardingToolbarPosition.Position
import org.mozilla.fenix.ext.asActivity
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.settings
import org.mozilla.fenix.onboarding.OnboardingRadioButton
@ -36,18 +39,28 @@ class OnboardingToolbarPositionPickerViewHolder(view: View) : RecyclerView.ViewH
radio.updateRadioValue(true)
radioBottomToolbar.onClickListener {
itemView.context.components.analytics.metrics
.track(Event.OnboardingToolbarPosition(Position.BOTTOM))
itemView.context.asActivity()?.recreate()
}
view.toolbar_bottom_image.setOnClickListener {
itemView.context.components.analytics.metrics
.track(Event.OnboardingToolbarPosition(Position.BOTTOM))
radioBottomToolbar.performClick()
}
radioTopToolbar.onClickListener {
itemView.context.components.analytics.metrics
.track(Event.OnboardingToolbarPosition(Position.TOP))
itemView.context.asActivity()?.recreate()
}
view.toolbar_top_image.setOnClickListener {
itemView.context.components.analytics.metrics
.track(Event.OnboardingToolbarPosition(Position.TOP))
radioTopToolbar.performClick()
}
}

View File

@ -9,6 +9,8 @@ import androidx.appcompat.widget.SwitchCompat
import androidx.recyclerview.widget.RecyclerView
import kotlinx.android.synthetic.main.onboarding_tracking_protection.view.*
import org.mozilla.fenix.R
import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.components.metrics.Event.OnboardingTrackingProtection.Setting
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.settings
import org.mozilla.fenix.onboarding.OnboardingRadioButton
@ -56,11 +58,15 @@ class OnboardingTrackingProtectionViewHolder(view: View) : RecyclerView.ViewHold
standardTrackingProtection.onClickListener {
updateTrackingProtectionPolicy()
view.context.components.analytics.metrics
.track(Event.OnboardingTrackingProtection(Setting.STANDARD))
}
view.clickable_region_standard.apply {
setOnClickListener {
standardTrackingProtection.performClick()
view.context.components.analytics.metrics
.track(Event.OnboardingTrackingProtection(Setting.STANDARD))
}
val standardTitle = view.context.getString(
R.string.onboarding_tracking_protection_standard_button_2
@ -73,11 +79,15 @@ class OnboardingTrackingProtectionViewHolder(view: View) : RecyclerView.ViewHold
strictTrackingProtection.onClickListener {
updateTrackingProtectionPolicy()
view.context.components.analytics.metrics
.track(Event.OnboardingTrackingProtection(Setting.STRICT))
}
view.clickable_region_strict.apply {
setOnClickListener {
strictTrackingProtection.performClick()
view.context.components.analytics.metrics
.track(Event.OnboardingTrackingProtection(Setting.STRICT))
}
val strictTitle =
view.context.getString(R.string.onboarding_tracking_protection_strict_option)

View File

@ -10,6 +10,8 @@ import android.view.View
import androidx.recyclerview.widget.RecyclerView
import kotlinx.android.synthetic.main.onboarding_whats_new.view.*
import org.mozilla.fenix.R
import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.home.sessioncontrol.OnboardingInteractor
class OnboardingWhatsNewViewHolder(
@ -31,6 +33,7 @@ class OnboardingWhatsNewViewHolder(
view.get_answers.text = textWithLink
view.get_answers.setOnClickListener {
interactor.onWhatsNewGetAnswersClicked()
view.context.components.analytics.metrics.track(Event.OnboardingWhatsNew)
}
}

View File

@ -122,6 +122,15 @@ The following metrics are added to the ping:
| media_state.pause |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |Media playback was paused. |[1](https://github.com/mozilla-mobile/fenix/pull/6463)||2020-09-01 |
| media_state.play |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |Media started playing. |[1](https://github.com/mozilla-mobile/fenix/pull/6463)||2020-09-01 |
| media_state.stop |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |Media playback has ended. |[1](https://github.com/mozilla-mobile/fenix/pull/6463)||2020-09-01 |
| onboarding.finish |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |The user taps starts browsing and ends the onboarding experience. |[1](https://github.com/mozilla-mobile/fenix/pull/11867)||2020-09-01 |
| onboarding.fxa_auto_signin |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |The onboarding automatic sign in card was tapped. |[1](https://github.com/mozilla-mobile/fenix/pull/11867)||2020-09-01 |
| onboarding.fxa_manual_signin |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |The onboarding manual sign in card was tapped. |[1](https://github.com/mozilla-mobile/fenix/pull/11867)||2020-09-01 |
| onboarding.pref_toggled_private_browsing |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |The private browsing preference was selected from the onboarding card. |[1](https://github.com/mozilla-mobile/fenix/pull/11867)||2020-09-01 |
| onboarding.pref_toggled_theme_picker |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |The device theme was chosen using the theme picker onboarding card. |[1](https://github.com/mozilla-mobile/fenix/pull/11867)|<ul><li>theme: A string that indicates the theme LIGHT, DARK, or FOLLOW DEVICE. Default: FOLLOW DEVICE </li></ul>|2020-09-01 |
| onboarding.pref_toggled_toolbar_position |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |The toolbar position preference was chosen from the onboarding card. |[1](https://github.com/mozilla-mobile/fenix/pull/11867)|<ul><li>position: A string that indicates the position of the toolbar TOP or BOTTOM. Default: BOTTOM </li></ul>|2020-09-01 |
| onboarding.pref_toggled_tracking_prot |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |The tracking protection preference was chosen from the onboarding card. |[1](https://github.com/mozilla-mobile/fenix/pull/11867)|<ul><li>position: A string that indicates the Tracking Protection policy STANDARD or STRICT. Default: Toggle ON, STANDARD </li></ul>|2020-09-01 |
| onboarding.privacy_notice |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |The onboarding privacy notice card was tapped. |[1](https://github.com/mozilla-mobile/fenix/pull/11867)||2020-09-01 |
| onboarding.whats_new |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |The onboarding What\'s New card was tapped. |[1](https://github.com/mozilla-mobile/fenix/pull/11867)||2020-09-01 |
| pocket.pocket_top_site_clicked |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user clicked on the trending Pocket top site |[1](https://github.com/mozilla-mobile/fenix/pull/8098)||2020-09-01 |
| pocket.pocket_top_site_removed |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user removed the trending Pocket top site |[1](https://github.com/mozilla-mobile/fenix/pull/8098)||2020-09-01 |
| private_browsing_mode.garbage_icon |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user pressed the garbage can icon on the private browsing home page, deleting all private tabs. |[1](https://github.com/mozilla-mobile/fenix/pull/4968)||2020-09-01 |