1
0
Fork 0

For #4658: Add some private browsing mode telemetry (#4968)

master
Yeon Taek Jeong 2019-08-28 14:41:37 -07:00 committed by GitHub
parent 09ed721015
commit d87b8a8a5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 144 additions and 2 deletions

View File

@ -1142,6 +1142,65 @@ search_widget:
- fenix-core@mozilla.com
expires: "2020-03-01"
private_browsing_mode:
garbage_icon:
type: event
description: >
A user pressed the garbage can icon on the private browsing home page,
deleting all private tabs.
bugs:
- 4658
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/4968
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"
snackbar_undo:
type: event
description: >
A user pressed the "undo" button in the snackbar that is shown when the garbage icon is
tapped.
bugs:
- 4658
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/4968
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"
notification_tapped:
type: event
description: >
A user pressed the private browsing mode notification itself.
bugs:
- 4658
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/4968
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"
notification_open:
type: event
description: >
A user pressed the private browsing mode notification's "Open" button.
bugs:
- 4658
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/4968
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"
notification_delete:
type: event
description: >
A user pressed the private browsing mode notification's "Delete and Open" button.
bugs:
- 4658
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/4968
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"
experiments.metrics:
active_experiment:
type: string

View File

@ -339,6 +339,7 @@ open class HomeActivity : AppCompatActivity(), ShareFragment.TabsSharedCallback
const val OPEN_TO_BROWSER = "open_to_browser"
const val OPEN_TO_BROWSER_AND_LOAD = "open_to_browser_and_load"
const val OPEN_TO_SEARCH = "open_to_search"
const val EXTRA_DELETE_PRIVATE_TABS = "notification"
const val EXTRA_DELETE_PRIVATE_TABS = "notification_delete_and_open"
const val EXTRA_OPENED_FROM_NOTIFICATION = "notification_open"
}
}

View File

@ -27,6 +27,7 @@ import org.mozilla.fenix.GleanMetrics.History
import org.mozilla.fenix.GleanMetrics.Library
import org.mozilla.fenix.GleanMetrics.Metrics
import org.mozilla.fenix.GleanMetrics.Pings
import org.mozilla.fenix.GleanMetrics.PrivateBrowsingMode
import org.mozilla.fenix.GleanMetrics.QrScanner
import org.mozilla.fenix.GleanMetrics.QuickActionSheet
import org.mozilla.fenix.GleanMetrics.ReaderMode
@ -314,6 +315,21 @@ private val Event.wrapper: EventWrapper<*>?
is Event.SearchWidgetVoiceSearchPressed -> EventWrapper<NoExtraKeys>(
{ SearchWidget.voiceButton.record(it) }
)
is Event.PrivateBrowsingGarbageIconTapped -> EventWrapper<NoExtraKeys>(
{ PrivateBrowsingMode.garbageIcon.record(it) }
)
is Event.PrivateBrowsingSnackbarUndoTapped -> EventWrapper<NoExtraKeys>(
{ PrivateBrowsingMode.snackbarUndo.record(it) }
)
is Event.PrivateBrowsingNotificationTapped -> EventWrapper<NoExtraKeys>(
{ PrivateBrowsingMode.notificationTapped.record(it) }
)
is Event.PrivateBrowsingNotificationOpenTapped -> EventWrapper<NoExtraKeys>(
{ PrivateBrowsingMode.notificationOpen.record(it) }
)
is Event.PrivateBrowsingNotificationDeleteAndOpenTapped -> EventWrapper<NoExtraKeys>(
{ PrivateBrowsingMode.notificationDelete.record(it) }
)
// Don't record other events in Glean:
is Event.AddBookmark -> null

View File

@ -96,6 +96,11 @@ sealed class Event {
object FindInPageNext : Event()
object FindInPagePrevious : Event()
object FindInPageSearchCommitted : Event()
object PrivateBrowsingGarbageIconTapped : Event()
object PrivateBrowsingSnackbarUndoTapped : Event()
object PrivateBrowsingNotificationTapped : Event()
object PrivateBrowsingNotificationOpenTapped : Event()
object PrivateBrowsingNotificationDeleteAndOpenTapped : Event()
// Interaction events with extras

View File

@ -616,6 +616,9 @@ class HomeFragment : Fragment(), AccountObserver {
view!!,
snackbarMessage,
getString(R.string.snackbar_deleted_undo), {
if (private) {
requireComponents.analytics.metrics.track(Event.PrivateBrowsingSnackbarUndoTapped)
}
deleteAllSessionsJob = null
emitSessionChanges()
},

View File

@ -7,6 +7,7 @@ package org.mozilla.fenix.home.intent
import android.content.Intent
import androidx.navigation.NavController
import org.mozilla.fenix.HomeActivity
import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.sessionsOfType
@ -21,10 +22,14 @@ class NotificationsIntentProcessor(
override fun process(intent: Intent, navController: NavController, out: Intent): Boolean {
return if (intent.extras?.getBoolean(HomeActivity.EXTRA_DELETE_PRIVATE_TABS) == true) {
out.putExtra(HomeActivity.EXTRA_DELETE_PRIVATE_TABS, false)
activity.components.analytics.metrics.track(Event.PrivateBrowsingNotificationDeleteAndOpenTapped)
activity.components.core.sessionManager.run {
sessionsOfType(private = true).forEach { remove(it) }
}
true
} else if (intent.extras?.getBoolean(HomeActivity.EXTRA_OPENED_FROM_NOTIFICATION) == true) {
activity.components.analytics.metrics.track(Event.PrivateBrowsingNotificationOpenTapped)
true
} else {
false
}

View File

@ -55,6 +55,7 @@ class TabHeaderViewHolder(
close_tabs_button.run {
setOnClickListener {
view.context.components.analytics.metrics.track(Event.PrivateBrowsingGarbageIconTapped)
actionEmitter.onNext(TabAction.CloseAll(true))
}
}

View File

@ -21,7 +21,9 @@ import mozilla.components.support.utils.ThreadUtils
import org.mozilla.fenix.R
import org.mozilla.fenix.HomeActivity
import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.metrics
import org.mozilla.fenix.ext.sessionsOfType
/**
@ -39,6 +41,7 @@ class SessionNotificationService : Service() {
}
ACTION_ERASE -> {
metrics.track(Event.PrivateBrowsingNotificationTapped)
components.core.sessionManager.removeAndCloseAllPrivateSessions()
if (!VisibilityLifecycleCallback.finishAndRemoveTaskIfInBackground(this)) {
@ -100,6 +103,7 @@ class SessionNotificationService : Service() {
private fun createOpenActionIntent(): PendingIntent {
val intent = Intent(this, HomeActivity::class.java)
intent.putExtra(HomeActivity.EXTRA_OPENED_FROM_NOTIFICATION, true)
return PendingIntent.getActivity(this, 1, intent, PendingIntent.FLAG_UPDATE_CURRENT)
}

View File

@ -1096,4 +1096,52 @@ Data that is sent in the activation ping
<td>2020-03-01</td>
</tr>
</table>
</pre>
</pre>
## private_browsing_mode
<pre>
<table style="width: 100%">
<tr>
<td>garbage_icon</td>
<td>event</td>
<td>A user pressed the garbage can icon on the private browsing home page, deleting all private tabs.</td>
<td><a href="https://github.com/mozilla-mobile/fenix/pull/4968">link</a></td>
<td></td>
<td>2020-03-01</td>
</tr>
<tr>
<td>snackbar_undo</td>
<td>event</td>
<td>A user pressed the "undo" button in the snackbar that is shown when the garbage icon is tapped.</td>
<td><a href="https://github.com/mozilla-mobile/fenix/pull/4968">link</a></td>
<td></td>
<td>2020-03-01</td>
</tr>
<tr>
<td>notification_tapped</td>
<td>event</td>
<td>A user pressed the private browsing mode notification itself.</td>
<td><a href="https://github.com/mozilla-mobile/fenix/pull/4968">link</a></td>
<td></td>
<td>2020-03-01</td>
</tr>
<tr>
<td>notification_open</td>
<td>event</td>
<td>A user pressed the private browsing mode notification's "Open" button.</td>
<td><a href="https://github.com/mozilla-mobile/fenix/pull/4968">link</a></td>
<td></td>
<td>2020-03-01</td>
</tr>
<tr>
<td>notification_delete</td>
<td>event</td>
<td>A user pressed the private browsing mode notification's "Delete and Open" button.</td>
<td><a href="https://github.com/mozilla-mobile/fenix/pull/4968">link</a></td>
<td></td>
<td>2020-03-01</td>
</tr>
</table>
</pre>