Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

For #4658: Add private browsing mode shortcut telemetry #5194

Merged
merged 1 commit into from
Sep 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions app/metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1237,6 +1237,74 @@ private_browsing_mode:
- fenix-core@mozilla.com
expires: "2020-03-01"

private_browsing_shortcut:
create_shortcut:
type: event
description: >
A user pressed the "Add private browsing shortcut" button in settings.
bugs:
- 4658
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/5194
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"
cfr_add_shortcut:
type: event
description: >
A user pressed the "Add shortcut" button when the contextual feature recommender appeared.
bugs:
- 4658
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/5194
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"
cfr_cancel:
type: event
description: >
A user pressed the "No thanks" button when the contextual feature recommender appeared.
bugs:
- 4658
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/5194
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"
pinned_shortcut_priv:
type: event
description: >
A user pressed the pinned private shortcut in Android home screen, opening up a new private search.
bugs:
- 4658
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/5194
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"
static_shortcut_tab:
type: event
description: >
A user pressed the long-press shortcut "Open new tab", opening up a new search.
bugs:
- 4658
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/5194
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"
static_shortcut_priv:
type: event
description: >
A user pressed the long-press shortcut "Open new private tab", opening up a new private search.
bugs:
- 4658
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/5194
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"

experiments.metrics:
active_experiment:
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ 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.PrivateBrowsingShortcut
import org.mozilla.fenix.GleanMetrics.QrScanner
import org.mozilla.fenix.GleanMetrics.QuickActionSheet
import org.mozilla.fenix.GleanMetrics.ReaderMode
Expand Down Expand Up @@ -336,6 +337,24 @@ private val Event.wrapper: EventWrapper<*>?
is Event.PrivateBrowsingNotificationDeleteAndOpenTapped -> EventWrapper<NoExtraKeys>(
{ PrivateBrowsingMode.notificationDelete.record(it) }
)
is Event.PrivateBrowsingCreateShortcut -> EventWrapper<NoExtraKeys>(
{ PrivateBrowsingShortcut.createShortcut.record(it) }
)
is Event.PrivateBrowsingAddShortcutCFR -> EventWrapper<NoExtraKeys>(
{ PrivateBrowsingShortcut.cfrAddShortcut.record(it) }
)
is Event.PrivateBrowsingCancelCFR -> EventWrapper<NoExtraKeys>(
{ PrivateBrowsingShortcut.cfrCancel.record(it) }
)
is Event.PrivateBrowsingPinnedShortcutPrivateTab -> EventWrapper<NoExtraKeys>(
{ PrivateBrowsingShortcut.pinnedShortcutPriv.record(it) }
)
is Event.PrivateBrowsingStaticShortcutTab -> EventWrapper<NoExtraKeys>(
{ PrivateBrowsingShortcut.staticShortcutTab.record(it) }
)
is Event.PrivateBrowsingStaticShortcutPrivateTab -> EventWrapper<NoExtraKeys>(
{ PrivateBrowsingShortcut.staticShortcutPriv.record(it) }
)
is Event.WhatsNewTapped -> EventWrapper(
{ Events.whatsNewTapped.record(it) },
{ Events.whatsNewTappedKeys.valueOf(it) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ sealed class Event {
object PrivateBrowsingNotificationTapped : Event()
object PrivateBrowsingNotificationOpenTapped : Event()
object PrivateBrowsingNotificationDeleteAndOpenTapped : Event()
object PrivateBrowsingCreateShortcut : Event()
object PrivateBrowsingAddShortcutCFR : Event()
object PrivateBrowsingCancelCFR : Event()
object PrivateBrowsingPinnedShortcutPrivateTab : Event()
object PrivateBrowsingStaticShortcutTab : Event()
object PrivateBrowsingStaticShortcutPrivateTab : Event()

// Interaction events with extras

Expand Down
6 changes: 5 additions & 1 deletion app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -571,12 +571,16 @@ class HomeFragment : Fragment(), AccountObserver {
)
layout.findViewById<Button>(R.id.cfr_pos_button).apply {
setOnClickListener {
context.metrics.track(Event.PrivateBrowsingAddShortcutCFR)
PrivateShortcutCreateManager.createPrivateShortcut(context)
trackingOnboarding.dismiss()
}
}
layout.findViewById<Button>(R.id.cfr_neg_button).apply {
setOnClickListener { trackingOnboarding.dismiss() }
setOnClickListener {
context.metrics.track(Event.PrivateBrowsingCancelCFR)
trackingOnboarding.dismiss()
}
}
// We want to show the popup only after privateBrowsingButton is available.
// Otherwise, we will encounter an activity token error.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ class StartSearchIntentProcessor(
return if (event != null) {
when (event) {
SEARCH_WIDGET -> metrics.track(Event.SearchWidgetNewTabPressed)
STATIC_SHORTCUT_NEW_TAB -> metrics.track(Event.PrivateBrowsingStaticShortcutTab)
STATIC_SHORTCUT_NEW_PRIVATE_TAB -> metrics.track(Event.PrivateBrowsingStaticShortcutPrivateTab)
PRIVATE_BROWSING_PINNED_SHORTCUT -> metrics.track(Event.PrivateBrowsingPinnedShortcutPrivateTab)
}

out.removeExtra(HomeActivity.OPEN_TO_SEARCH)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ import org.mozilla.fenix.components.PrivateShortcutCreateManager
import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.getPreferenceKey
import org.mozilla.fenix.ext.metrics
import org.mozilla.fenix.ext.requireComponents
import org.mozilla.fenix.ext.settings
import org.mozilla.fenix.utils.ItsNotBrokenSnack
Expand Down Expand Up @@ -157,6 +158,7 @@ class SettingsFragment : PreferenceFragmentCompat(), AccountObserver {
navigateToSitePermissions()
}
resources.getString(pref_key_add_private_browsing_shortcut) -> {
requireContext().metrics.track(Event.PrivateBrowsingCreateShortcut)
PrivateShortcutCreateManager.createPrivateShortcut(requireContext())
}
resources.getString(pref_key_accessibility) -> {
Expand Down
54 changes: 54 additions & 0 deletions docs/metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -1174,3 +1174,57 @@ Data that is sent in the activation ping
</table>
</pre>

## private_browsing_shortcut

<pre>
<table style="width: 100%">
<tr>
<td>create_shortcut</td>
<td>event</td>
<td>A user pressed the "Add private browsing shortcut" button in settings.</td>
<td><a href="https://github.com/mozilla-mobile/fenix/pull/5194">link</a></td>
<td></td>
<td>2020-03-01</td>
</tr>
<tr>
<td>cfr_add_shortcut</td>
<td>event</td>
<td>A user pressed the "Add shortcut" button when the contextual feature recommender appeared.</td>
<td><a href="https://github.com/mozilla-mobile/fenix/pull/5194">link</a></td>
<td></td>
<td>2020-03-01</td>
</tr>
<tr>
<td>cfr_cancel</td>
<td>event</td>
<td>A user pressed the "No thanks" button when the contextual feature recommender appeared.</td>
<td><a href="https://github.com/mozilla-mobile/fenix/pull/5194">link</a></td>
<td></td>
<td>2020-03-01</td>
</tr>
<tr>
<td>pinned_shortcut_priv</td>
<td>event</td>
<td>A user pressed the pinned private shortcut in Android home screen, opening up a new private search.</td>
<td><a href="https://github.com/mozilla-mobile/fenix/pull/5194">link</a></td>
<td></td>
<td>2020-03-01</td>
</tr>
<tr>
<td>static_shortcut_tab</td>
<td>event</td>
<td>A user pressed the long-press shortcut "Open new tab", opening up a new search.</td>
<td><a href="https://github.com/mozilla-mobile/fenix/pull/5194">link</a></td>
<td></td>
<td>2020-03-01</td>
</tr>
<tr>
<td>static_shortcut_priv</td>
<td>event</td>
<td>A user pressed the long-press shortcut "Open new private tab", opening up a new private search.</td>
<td><a href="https://github.com/mozilla-mobile/fenix/pull/5194">link</a></td>
<td></td>
<td>2020-03-01</td>
</tr>
</table>
</pre>