1
0
Fork 0

For #969: Adds more telemetry for collections (#4358)

master
Sawyer Blatz 2019-07-31 17:07:41 -07:00 committed by Jeff Boek
parent 4922e5d09d
commit 2e7a61860a
8 changed files with 99 additions and 1 deletions

View File

@ -1051,4 +1051,43 @@ collections:
- https://github.com/mozilla-mobile/fenix/pull/3935
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"
expires: "2020-03-01"
add_tab_button:
type: event
description: >
A user tapped the "add tab" button in the three dot menu of collections
bugs:
- 969
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/4358
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"
long_press:
type: event
description: >
A user long pressed on a tab, triggering the collection creation screen
bugs:
- 969
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/4358
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"
save_button:
type: event
description: >
A user pressed the "save to collection" button on either the home or browser screen, triggering the
collection creation screen to open (tab_select_opened)
bugs:
- 969
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/4358
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"
extra_keys:
from_screen:
description: >
A string representing the screen from which the user pressed the save button.
Either `browser` or `home`

View File

@ -265,6 +265,16 @@ private val Event.wrapper
is Event.CollectionTabSelectOpened -> EventWrapper<NoExtraKeys>(
{ Collections.tabSelectOpened.record(it) }
)
is Event.CollectionTabLongPressed -> EventWrapper<NoExtraKeys>(
{ Collections.longPress.record(it) }
)
is Event.CollectionSaveButtonPressed -> EventWrapper(
{ Collections.saveButton.record(it) },
{ Collections.saveButtonKeys.valueOf(it) }
)
is Event.CollectionAddTabPressed -> EventWrapper<NoExtraKeys>(
{ Collections.addTabButton.record(it) }
)
// Don't track other events with Glean
else -> null

View File

@ -108,6 +108,8 @@ sealed class Event {
object CollectionShared : Event()
object CollectionRemoved : Event()
object CollectionTabSelectOpened : Event()
object CollectionTabLongPressed : Event()
object CollectionAddTabPressed : Event()
data class PreferenceToggled(val preferenceKey: String, val enabled: Boolean, val context: Context) : Event() {
private val switchPreferenceTelemetryAllowList = listOf(
@ -131,6 +133,11 @@ sealed class Event {
}
// Interaction Events
data class CollectionSaveButtonPressed(val fromScreen: String) : Event() {
override val extras: Map<String, String>?
get() = mapOf("from_screen" to fromScreen)
}
data class CollectionSaved(val tabsOpenCount: Int, val tabsSelectedCount: Int) : Event() {
override val extras: Map<String, String>?
get() = mapOf(

View File

@ -121,6 +121,8 @@ class DefaultBrowserToolbarController(
BrowsingModeManager.Mode.Normal
}
ToolbarMenu.Item.SaveToCollection -> {
context.components.analytics.metrics
.track(Event.CollectionSaveButtonPressed(TELEMETRY_BROWSER_IDENITIFIER))
currentSession.let {
val tab = it.toTab(context)
viewModel.tabs = listOf(tab)
@ -184,4 +186,8 @@ class DefaultBrowserToolbarController(
context.components.analytics.metrics.track(Event.BrowserMenuItemTapped(eventItem))
}
companion object {
private const val TELEMETRY_BROWSER_IDENITIFIER = "browser"
}
}

View File

@ -464,6 +464,7 @@ class HomeFragment : Fragment(), AccountObserver {
createDeleteCollectionPrompt(action.collection)
}
is CollectionAction.AddTab -> {
requireComponents.analytics.metrics.track(Event.CollectionAddTabPressed)
showCollectionCreationFragment(
selectedTabCollection = action.collection,
step = SaveCollectionStep.SelectTabs
@ -841,6 +842,7 @@ class HomeFragment : Fragment(), AccountObserver {
private const val FADE_ANIM_DURATION = 150L
private const val ANIM_SNACKBAR_DELAY = 100L
private const val ACCESSIBILITY_FOCUS_DELAY = 2000L
private const val TELEMETRY_HOME_IDENITIFIER = "home"
private const val SHARED_TRANSITION_MS = 200L
private const val TAB_ITEM_TRANSITION_NAME = "tab_item"
private const val toolbarPaddingDp = 12f

View File

@ -9,6 +9,8 @@ import androidx.recyclerview.widget.RecyclerView
import io.reactivex.Observer
import kotlinx.android.synthetic.main.save_tab_group_button.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.SessionControlAction
import org.mozilla.fenix.home.sessioncontrol.TabAction
import org.mozilla.fenix.home.sessioncontrol.onNext
@ -20,11 +22,15 @@ class SaveTabGroupViewHolder(
init {
view.save_tab_group_button.setOnClickListener {
view.context.components.analytics.metrics
.track(Event.CollectionSaveButtonPressed(TELEMETRY_HOME_IDENITIFIER))
actionEmitter.onNext(TabAction.SaveTabGroup(selectedTabSessionId = null))
}
}
companion object {
const val TELEMETRY_HOME_IDENITIFIER = "home"
const val LAYOUT_ID = R.layout.save_tab_group_button
}
}

View File

@ -16,6 +16,7 @@ import mozilla.components.browser.menu.BrowserMenuBuilder
import mozilla.components.browser.menu.item.SimpleBrowserMenuItem
import mozilla.components.support.ktx.android.util.dpToFloat
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.ext.loadIntoView
@ -48,6 +49,7 @@ class TabViewHolder(
}
item_tab.setOnLongClickListener {
view.context.components.analytics.metrics.track(Event.CollectionTabLongPressed)
actionEmitter.onNext(TabAction.SaveTabGroup(tab?.sessionId!!))
true
}

View File

@ -888,6 +888,32 @@ tabs_selected: The number of tabs added to the collection
<td></td>
<td>2020-03-01</td>
</tr>
<tr>
<td>add_tab_button</td>
<td>event</td>
<td> A user tapped the "add tab" button in the three dot menu of collections</td>
<td><a href="https://github.com/mozilla-mobile/fenix/pull/4358">link</a></td>
<td></td>
<td>2020-03-01</td>
</tr>
<tr>
<td>long_press</td>
<td>event</td>
<td> A user long pressed on a tab, triggering the collection creation screen</td>
<td><a href="https://github.com/mozilla-mobile/fenix/pull/4358">link</a></td>
<td></td>
<td>2020-03-01</td>
</tr>
<tr>
<td>save_button</td>
<td>event</td>
<td>A user pressed the "save to collection" button on either the home or browser screen, triggering the
collection creation screen to open (tab_select_opened)</td>
<td><a href="https://github.com/mozilla-mobile/fenix/pull/3935">link</a></td>
<td>from_screen: A string representing the screen from which the user pressed the save button. Either `browser` or `home`
</td>
<td>2020-03-01</td>
</tr>
</table>
</pre>