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

nightly-build-test
Yeon Taek Jeong 5 years ago committed by GitHub
parent 09ed721015
commit d87b8a8a5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1142,6 +1142,65 @@ search_widget:
- fenix-core@mozilla.com - fenix-core@mozilla.com
expires: "2020-03-01" 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: experiments.metrics:
active_experiment: active_experiment:
type: string type: string

@ -339,6 +339,7 @@ open class HomeActivity : AppCompatActivity(), ShareFragment.TabsSharedCallback
const val OPEN_TO_BROWSER = "open_to_browser" const val OPEN_TO_BROWSER = "open_to_browser"
const val OPEN_TO_BROWSER_AND_LOAD = "open_to_browser_and_load" const val OPEN_TO_BROWSER_AND_LOAD = "open_to_browser_and_load"
const val OPEN_TO_SEARCH = "open_to_search" 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"
} }
} }

@ -27,6 +27,7 @@ import org.mozilla.fenix.GleanMetrics.History
import org.mozilla.fenix.GleanMetrics.Library import org.mozilla.fenix.GleanMetrics.Library
import org.mozilla.fenix.GleanMetrics.Metrics import org.mozilla.fenix.GleanMetrics.Metrics
import org.mozilla.fenix.GleanMetrics.Pings import org.mozilla.fenix.GleanMetrics.Pings
import org.mozilla.fenix.GleanMetrics.PrivateBrowsingMode
import org.mozilla.fenix.GleanMetrics.QrScanner import org.mozilla.fenix.GleanMetrics.QrScanner
import org.mozilla.fenix.GleanMetrics.QuickActionSheet import org.mozilla.fenix.GleanMetrics.QuickActionSheet
import org.mozilla.fenix.GleanMetrics.ReaderMode import org.mozilla.fenix.GleanMetrics.ReaderMode
@ -314,6 +315,21 @@ private val Event.wrapper: EventWrapper<*>?
is Event.SearchWidgetVoiceSearchPressed -> EventWrapper<NoExtraKeys>( is Event.SearchWidgetVoiceSearchPressed -> EventWrapper<NoExtraKeys>(
{ SearchWidget.voiceButton.record(it) } { 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: // Don't record other events in Glean:
is Event.AddBookmark -> null is Event.AddBookmark -> null

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

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

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

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

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

@ -1096,4 +1096,52 @@ Data that is sent in the activation ping
<td>2020-03-01</td> <td>2020-03-01</td>
</tr> </tr>
</table> </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>

Loading…
Cancel
Save