1
0
Fork 0

For #9625: Add telemetry for Tracking Protection CFR (#11923)

master
Sawyer Blatz 2020-06-25 11:24:55 -07:00 committed by GitHub
parent 45bc42f92d
commit 04aee11d82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 96 additions and 3 deletions

View File

@ -1866,6 +1866,57 @@ private_browsing_mode:
- fenix-core@mozilla.com
expires: "2020-09-01"
contextual_hint.tracking_protection:
display:
type: event
description: |
The enhanced tracking protection contextual hint was
displayed.
bugs:
- https://github.com/mozilla-mobile/fenix/issues/9625
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/11923
notification_emails:
- fenix-core@mozilla.com
expires: "2020-09-01"
dismiss:
type: event
description: |
The enhanced tracking protection contextual hint was
dismissed
by pressing the close button
bugs:
- https://github.com/mozilla-mobile/fenix/issues/9625
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/11923
notification_emails:
- fenix-core@mozilla.com
expires: "2020-09-01"
outside_tap:
type: event
description: |
The user tapped outside of the etp contextual hint
(which has no effect).
bugs:
- https://github.com/mozilla-mobile/fenix/issues/9625
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/11923
notification_emails:
- fenix-core@mozilla.com
expires: "2020-09-01"
inside_tap:
type: event
description: |
The user tapped inside of the etp contextual hint
(which brings up the etp panel for this site).
bugs:
- https://github.com/mozilla-mobile/fenix/issues/9625
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/11923
notification_emails:
- fenix-core@mozilla.com
expires: "2020-09-01"
tracking_protection:
exception_added:
type: event

View File

@ -16,6 +16,7 @@ import org.mozilla.fenix.GleanMetrics.BookmarksManagement
import org.mozilla.fenix.GleanMetrics.BrowserSearch
import org.mozilla.fenix.GleanMetrics.Collections
import org.mozilla.fenix.GleanMetrics.ContextMenu
import org.mozilla.fenix.GleanMetrics.ContextualHintTrackingProtection
import org.mozilla.fenix.GleanMetrics.CrashReporter
import org.mozilla.fenix.GleanMetrics.CustomTab
import org.mozilla.fenix.GleanMetrics.DownloadNotification
@ -585,6 +586,22 @@ private val Event.wrapper: EventWrapper<*>?
{ Onboarding.prefToggledToolbarPositionKeys.valueOf(it) }
)
is Event.ContextualHintETPDisplayed -> EventWrapper<NoExtraKeys>(
{ ContextualHintTrackingProtection.display.record(it) }
)
is Event.ContextualHintETPDismissed -> EventWrapper<NoExtraKeys>(
{ ContextualHintTrackingProtection.dismiss.record(it) }
)
is Event.ContextualHintETPInsideTap -> EventWrapper<NoExtraKeys>(
{ ContextualHintTrackingProtection.insideTap.record(it) }
)
is Event.ContextualHintETPOutsideTap -> EventWrapper<NoExtraKeys>(
{ ContextualHintTrackingProtection.outsideTap.record(it) }
)
// Don't record other events in Glean:
is Event.AddBookmark -> null
is Event.OpenedBookmark -> null

View File

@ -179,6 +179,11 @@ sealed class Event {
object OnboardingWhatsNew : Event()
object OnboardingFinish : Event()
object ContextualHintETPDisplayed : Event()
object ContextualHintETPDismissed : Event()
object ContextualHintETPOutsideTap : Event()
object ContextualHintETPInsideTap : Event()
// Interaction events with extras
data class OnboardingToolbarPosition(val position: Position) : Event() {
enum class Position { TOP, BOTTOM }

View File

@ -10,6 +10,7 @@ import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.view.Gravity
import android.view.LayoutInflater
import android.view.MotionEvent
import android.view.View
import android.widget.ImageView
import androidx.core.view.isGone
@ -19,6 +20,8 @@ import kotlinx.android.synthetic.main.tracking_protection_onboarding_popup.*
import kotlinx.android.synthetic.main.tracking_protection_onboarding_popup.view.*
import mozilla.components.browser.session.Session
import org.mozilla.fenix.R
import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.increaseTapArea
import org.mozilla.fenix.utils.Settings
@ -40,13 +43,23 @@ class TrackingProtectionOverlay(
private fun shouldShowTrackingProtectionOnboarding(session: Session) =
settings.shouldShowTrackingProtectionOnboarding &&
session.trackerBlockingEnabled &&
session.trackersBlocked.isNotEmpty()
session.trackerBlockingEnabled &&
session.trackersBlocked.isNotEmpty()
@Suppress("MagicNumber", "InflateParams")
private fun showTrackingProtectionOnboarding() {
if (!getToolbar().hasWindowFocus()) return
val trackingOnboardingDialog = Dialog(context)
val trackingOnboardingDialog = object : Dialog(context) {
override fun onTouchEvent(event: MotionEvent): Boolean {
if (event.action == MotionEvent.ACTION_DOWN) {
context.components.analytics.metrics.track(Event.ContextualHintETPOutsideTap)
}
return super.onTouchEvent(event)
}
}
val layout = LayoutInflater.from(context)
.inflate(R.layout.tracking_protection_onboarding_popup, null)
val isBottomToolbar = Settings.getInstance(context).shouldUseBottomToolbar
@ -63,6 +76,7 @@ class TrackingProtectionOverlay(
val closeButton = layout.findViewById<ImageView>(R.id.close_onboarding)
closeButton.increaseTapArea(BUTTON_INCREASE_DPS)
closeButton.setOnClickListener {
context.components.analytics.metrics.track(Event.ContextualHintETPDismissed)
trackingOnboardingDialog.dismiss()
}
@ -101,10 +115,12 @@ class TrackingProtectionOverlay(
val etpShield =
getToolbar().findViewById<View>(R.id.mozac_browser_toolbar_tracking_protection_indicator)
trackingOnboardingDialog.message.setOnClickListener {
context.components.analytics.metrics.track(Event.ContextualHintETPInsideTap)
trackingOnboardingDialog.dismiss()
etpShield.performClick()
}
context.components.analytics.metrics.track(Event.ContextualHintETPDisplayed)
trackingOnboardingDialog.show()
settings.incrementTrackingProtectionOnboardingCount()
}

View File

@ -82,6 +82,10 @@ The following metrics are added to the ping:
| collections.tab_select_opened |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user opened the select tabs screen (the first step of the collection creation flow) |[1](https://github.com/mozilla-mobile/fenix/pull/3935)||2020-09-01 |
| collections.tabs_added |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user saved a list of tabs to an existing collection |[1](https://github.com/mozilla-mobile/fenix/pull/3935)|<ul><li>tabs_open: The number of tabs open in the current session</li><li>tabs_selected: The number of tabs added to the collection</li></ul>|2020-09-01 |
| context_menu.item_tapped |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user tapped an item in the browsers context menu |[1](https://github.com/mozilla-mobile/fenix/pull/1344#issuecomment-479285010)|<ul><li>named: The name of the item that was tapped. Available items are: ``` open_in_new_tab, open_in_private_tab, open_image_in_new_tab, save_image, share_link, copy_link, copy_image_location ``` </li></ul>|2020-09-01 |
| contextual_hint.tracking_protection.dismiss |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |The enhanced tracking protection contextual hint was dismissed by pressing the close button |[1](https://github.com/mozilla-mobile/fenix/pull/TODO)||2020-09-01 |
| contextual_hint.tracking_protection.display |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |The enhanced tracking protection contextual hint was displayed. |[1](https://github.com/mozilla-mobile/fenix/pull/TODO)||2020-09-01 |
| contextual_hint.tracking_protection.inside_tap |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |The user tapped inside of the etp contextual hint (which brings up the etp panel for this site). |[1](https://github.com/mozilla-mobile/fenix/pull/TODO)||2020-09-01 |
| contextual_hint.tracking_protection.outside_tap |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |The user tapped outside of the etp contextual hint (which has no effect). |[1](https://github.com/mozilla-mobile/fenix/pull/TODO)||2020-09-01 |
| crash_reporter.closed |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |The crash reporter was closed |[1](https://github.com/mozilla-mobile/fenix/pull/1214#issue-264756708)|<ul><li>crash_submitted: A boolean that tells us whether or not the user submitted a crash report </li></ul>|2020-09-01 |
| crash_reporter.opened |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |The crash reporter was displayed |[1](https://github.com/mozilla-mobile/fenix/pull/1214#issue-264756708)||2020-09-01 |
| custom_tab.action_button |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user pressed the action button provided by the launching app |[1](https://github.com/mozilla-mobile/fenix/pull/1697)||2020-09-01 |