From 46eaca28714591a5902366f7fc4a1e01963875fc Mon Sep 17 00:00:00 2001 From: Sawyer Blatz Date: Mon, 19 Aug 2019 14:49:48 -0700 Subject: [PATCH] [fenix] For https://github.com/mozilla-mobile/fenix/issues/4421: Fixes issues with new glean events (https://github.com/mozilla-mobile/fenix/pull/4816) --- app/metrics.yaml | 11 +++++++++++ .../collections/CreateCollectionFragment.kt | 10 ++++++++-- .../components/metrics/GleanMetricsService.kt | 6 +++--- docs/metrics.md | 16 ++++++++++++++++ 4 files changed, 38 insertions(+), 5 deletions(-) diff --git a/app/metrics.yaml b/app/metrics.yaml index f2ce0f37d0..3845454aac 100644 --- a/app/metrics.yaml +++ b/app/metrics.yaml @@ -793,6 +793,17 @@ sync_auth: notification_emails: - fenix-core@mozilla.com expires: "2020-03-01" + sign_up: + type: event + description: > + A user signed up for a new FxA account + bugs: + - 4421 + data_reviews: + - https://github.com/mozilla-mobile/fenix/pull/4816 + notification_emails: + - fenix-core@mozilla.com + expires: "2020-03-01" scan_pairing: type: event description: > diff --git a/app/src/main/java/org/mozilla/fenix/collections/CreateCollectionFragment.kt b/app/src/main/java/org/mozilla/fenix/collections/CreateCollectionFragment.kt index 369f58d270..804b133d92 100644 --- a/app/src/main/java/org/mozilla/fenix/collections/CreateCollectionFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/collections/CreateCollectionFragment.kt @@ -121,7 +121,7 @@ class CreateCollectionFragment : DialogFragment() { } context.components.analytics.metrics.track( - Event.CollectionSaved(context.components.core.sessionManager.size, sessionBundle.size) + Event.CollectionSaved(normalSessionSize(), sessionBundle.size) ) closeTabsIfNecessary(it.tabs) @@ -137,7 +137,7 @@ class CreateCollectionFragment : DialogFragment() { } context.components.analytics.metrics.track( - Event.CollectionTabsAdded(context.components.core.sessionManager.size, sessionBundle.size) + Event.CollectionTabsAdded(normalSessionSize(), sessionBundle.size) ) closeTabsIfNecessary(it.tabs) @@ -154,6 +154,12 @@ class CreateCollectionFragment : DialogFragment() { } } + private fun normalSessionSize(): Int { + return requireComponents.core.sessionManager.sessions.filter { session -> + (!session.isCustomTabSession() && !session.private) + }.size + } + private fun handleBackPress(backPressFrom: SaveCollectionStep) { when (backPressFrom) { SaveCollectionStep.SelectTabs -> dismiss() 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 d8c7af289b..c1024bd507 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 @@ -212,6 +212,9 @@ private val Event.wrapper is Event.SyncAuthSignOut -> EventWrapper( { SyncAuth.signOut.record(it) } ) + is Event.FXANewSignup -> EventWrapper( + { SyncAuth.signUp.record(it) } + ) is Event.SyncAuthScanPairing -> EventWrapper( { SyncAuth.scanPairing.record(it) } ) @@ -300,9 +303,6 @@ private val Event.wrapper is Event.SearchWidgetVoiceSearchPressed -> EventWrapper( { SearchWidget.voiceButton.record(it) } ) - is Event.FXANewSignup -> EventWrapper( - { Collections.renameButton.record(it) } - ) // Don't track other events with Glean else -> null diff --git a/docs/metrics.md b/docs/metrics.md index 46af067b32..b90ed7b8e9 100644 --- a/docs/metrics.md +++ b/docs/metrics.md @@ -639,6 +639,22 @@ tracking_protection 2020-03-01 + + sign_out + event + A user pressed the sign out button on the sync account page and was successfully signed out of FxA + link + + 2020-03-01 + + + sign_up + event + A user signed up for a new FxA account + link + + 2020-03-01 + scan_pairing event