diff --git a/app/metrics.yaml b/app/metrics.yaml index d5e900ce1d..2d996f067c 100644 --- a/app/metrics.yaml +++ b/app/metrics.yaml @@ -1090,4 +1090,15 @@ collections: from_screen: description: > A string representing the screen from which the user pressed the save button. - Either `browser` or `home` \ No newline at end of file + Currently one of: `browserMenu`, `homeMenu` or `home` + rename_button: + type: event + description: > + A user pressed the "rename collection" button in the three dot menu + bugs: + - 969 + data_reviews: + - https://github.com/mozilla-mobile/fenix/pull/4539 + notification_emails: + - fenix-core@mozilla.com + expires: "2020-03-01" \ No newline at end of file diff --git a/app/src/main/java/org/mozilla/fenix/components/metrics/GleanMetricsService.kt b/app/src/main/java/org/mozilla/fenix/components/metrics/GleanMetricsService.kt index 8b90cc8d0a..bad50c5288 100644 --- a/app/src/main/java/org/mozilla/fenix/components/metrics/GleanMetricsService.kt +++ b/app/src/main/java/org/mozilla/fenix/components/metrics/GleanMetricsService.kt @@ -279,6 +279,9 @@ private val Event.wrapper is Event.CollectionAddTabPressed -> EventWrapper( { Collections.addTabButton.record(it) } ) + is Event.CollectionRenamePressed -> EventWrapper( + { Collections.renameButton.record(it) } + ) is Event.CollectionSaved -> EventWrapper( { Collections.saved.record(it) }, { Collections.savedKeys.valueOf(it) } diff --git a/app/src/main/java/org/mozilla/fenix/components/metrics/Metrics.kt b/app/src/main/java/org/mozilla/fenix/components/metrics/Metrics.kt index d255a9288d..14038a5915 100644 --- a/app/src/main/java/org/mozilla/fenix/components/metrics/Metrics.kt +++ b/app/src/main/java/org/mozilla/fenix/components/metrics/Metrics.kt @@ -110,6 +110,7 @@ sealed class Event { object CollectionTabSelectOpened : Event() object CollectionTabLongPressed : Event() object CollectionAddTabPressed : Event() + object CollectionRenamePressed : Event() data class PreferenceToggled(val preferenceKey: String, val enabled: Boolean, val context: Context) : Event() { private val switchPreferenceTelemetryAllowList = listOf( diff --git a/app/src/main/java/org/mozilla/fenix/components/toolbar/BrowserToolbarController.kt b/app/src/main/java/org/mozilla/fenix/components/toolbar/BrowserToolbarController.kt index f2a68370c0..ec47345cf2 100644 --- a/app/src/main/java/org/mozilla/fenix/components/toolbar/BrowserToolbarController.kt +++ b/app/src/main/java/org/mozilla/fenix/components/toolbar/BrowserToolbarController.kt @@ -122,7 +122,7 @@ class DefaultBrowserToolbarController( } ToolbarMenu.Item.SaveToCollection -> { context.components.analytics.metrics - .track(Event.CollectionSaveButtonPressed(TELEMETRY_BROWSER_IDENITIFIER)) + .track(Event.CollectionSaveButtonPressed(TELEMETRY_BROWSER_IDENTIFIER)) currentSession.let { val tab = it.toTab(context) viewModel.tabs = listOf(tab) @@ -188,6 +188,6 @@ class DefaultBrowserToolbarController( } companion object { - private const val TELEMETRY_BROWSER_IDENITIFIER = "browser" + private const val TELEMETRY_BROWSER_IDENTIFIER = "browserMenu" } } diff --git a/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt b/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt index 33d82d453b..1c16ccfde6 100644 --- a/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt @@ -472,6 +472,7 @@ class HomeFragment : Fragment(), AccountObserver { selectedTabCollection = action.collection, step = SaveCollectionStep.RenameCollection ) + requireComponents.analytics.metrics.track(Event.CollectionRenamePressed) } is CollectionAction.OpenTab -> { invokePendingDeleteJobs() diff --git a/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/viewholders/SaveTabGroupViewHolder.kt b/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/viewholders/SaveTabGroupViewHolder.kt index 519642a706..c8d48b3512 100644 --- a/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/viewholders/SaveTabGroupViewHolder.kt +++ b/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/viewholders/SaveTabGroupViewHolder.kt @@ -23,14 +23,14 @@ class SaveTabGroupViewHolder( init { view.save_tab_group_button.setOnClickListener { view.context.components.analytics.metrics - .track(Event.CollectionSaveButtonPressed(TELEMETRY_HOME_IDENITIFIER)) + .track(Event.CollectionSaveButtonPressed(TELEMETRY_HOME_IDENTIFIER)) actionEmitter.onNext(TabAction.SaveTabGroup(selectedTabSessionId = null)) } } companion object { - const val TELEMETRY_HOME_IDENITIFIER = "home" + const val TELEMETRY_HOME_IDENTIFIER = "home" const val LAYOUT_ID = R.layout.save_tab_group_button } } diff --git a/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/viewholders/TabHeaderViewHolder.kt b/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/viewholders/TabHeaderViewHolder.kt index 624bfcb0e5..027f969d27 100644 --- a/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/viewholders/TabHeaderViewHolder.kt +++ b/app/src/main/java/org/mozilla/fenix/home/sessioncontrol/viewholders/TabHeaderViewHolder.kt @@ -13,6 +13,8 @@ import mozilla.components.browser.menu.BrowserMenu import mozilla.components.browser.menu.BrowserMenuBuilder import mozilla.components.browser.menu.item.SimpleBrowserMenuItem 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 @@ -29,11 +31,11 @@ class TabHeaderViewHolder( when (it) { is TabHeaderMenu.Item.Share -> actionEmitter.onNext(TabAction.ShareTabs) is TabHeaderMenu.Item.CloseAll -> actionEmitter.onNext(TabAction.CloseAll(isPrivate)) - is TabHeaderMenu.Item.SaveToCollection -> actionEmitter.onNext( - TabAction.SaveTabGroup( - null - ) - ) + is TabHeaderMenu.Item.SaveToCollection -> { + actionEmitter.onNext(TabAction.SaveTabGroup(null)) + view.context.components.analytics.metrics + .track(Event.CollectionSaveButtonPressed(TELEMETRY_HOME_MENU_IDENITIFIER)) + } } } @@ -99,6 +101,7 @@ class TabHeaderViewHolder( } companion object { + const val TELEMETRY_HOME_MENU_IDENITIFIER = "homeMenu" const val LAYOUT_ID = R.layout.tab_header } } diff --git a/docs/metrics.md b/docs/metrics.md index d3f6aca19e..a495fb5c1d 100644 --- a/docs/metrics.md +++ b/docs/metrics.md @@ -891,7 +891,7 @@ tabs_selected: The number of tabs added to the collection add_tab_button event - A user tapped the "add tab" button in the three dot menu of collections + A user tapped the "add tab" button in the three dot menu of collections link 2020-03-01 @@ -899,7 +899,7 @@ tabs_selected: The number of tabs added to the collection long_press event - A user long pressed on a tab, triggering the collection creation screen + A user long pressed on a tab, triggering the collection creation screen link 2020-03-01 @@ -914,6 +914,14 @@ tabs_selected: The number of tabs added to the collection 2020-03-01 + + rename_button + event + A user pressed the "rename collection" button in the three dot menu + link + + 2020-03-01 +