Closes #18163: Use SyncedTabsFacts for Synced Tab Telemetry (#18172)

upstream-sync
Roger Yang 3 years ago committed by GitHub
parent 94425d22ac
commit aada459428
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -4538,3 +4538,18 @@ engine_tab:
- fenix-core@mozilla.com
- skaspari@mozilla.com
expires: "2021-12-31"
synced_tabs:
synced_tabs_suggestion_clicked:
type: event
description: |
The synced tab suggestion in awesomebar was clicked.
bugs:
- https://github.com/mozilla-mobile/fenix/issues/18163
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/18172
data_sensitivity:
- interaction
notification_emails:
- fenix-core@mozilla.com
expires: "2021-08-01"

@ -214,6 +214,8 @@ sealed class Event {
object HaveTopSites : Event()
object HaveNoTopSites : Event()
object SyncedTabSuggestionClicked : Event()
// Interaction events with extras
data class TopSiteSwipeCarousel(val page: Int) : Event() {

@ -53,6 +53,7 @@ import org.mozilla.fenix.GleanMetrics.SearchSuggestions
import org.mozilla.fenix.GleanMetrics.SearchWidget
import org.mozilla.fenix.GleanMetrics.SyncAccount
import org.mozilla.fenix.GleanMetrics.SyncAuth
import org.mozilla.fenix.GleanMetrics.SyncedTabs
import org.mozilla.fenix.GleanMetrics.Tab
import org.mozilla.fenix.GleanMetrics.Tabs
import org.mozilla.fenix.GleanMetrics.TabsTray
@ -749,6 +750,9 @@ private val Event.wrapper: EventWrapper<*>?
is Event.BannerOpenInAppGoToSettings -> EventWrapper<NoExtraKeys>(
{ BannerOpenInApp.goToSettings.record(it) }
)
is Event.SyncedTabSuggestionClicked -> EventWrapper<NoExtraKeys>(
{ SyncedTabs.syncedTabsSuggestionClicked.record(it) }
)
// Don't record other events in Glean:
is Event.AddBookmark -> null

@ -22,6 +22,7 @@ import mozilla.components.feature.findinpage.facts.FindInPageFacts
import mozilla.components.feature.media.facts.MediaFacts
import mozilla.components.feature.prompts.dialog.LoginDialogFacts
import mozilla.components.feature.pwa.ProgressiveWebAppFacts
import mozilla.components.feature.syncedtabs.facts.SyncedTabsFacts
import mozilla.components.feature.top.sites.facts.TopSitesFacts
import mozilla.components.support.base.Component
import mozilla.components.support.base.facts.Action
@ -267,6 +268,9 @@ internal class ReleaseMetricController(
}
null
}
Component.FEATURE_SYNCEDTABS to SyncedTabsFacts.Items.SYNCED_TABS_SUGGESTION_CLICKED -> {
Event.SyncedTabSuggestionClicked
}
else -> null
}

@ -20,6 +20,7 @@ import org.junit.runner.RunWith
import org.mozilla.fenix.GleanMetrics.Events
import org.mozilla.fenix.GleanMetrics.Metrics
import org.mozilla.fenix.GleanMetrics.SearchDefaultEngine
import org.mozilla.fenix.GleanMetrics.SyncedTabs
import org.mozilla.fenix.helpers.FenixRobolectricTestRunner
import org.mozilla.fenix.utils.BrowsersCache
@ -85,4 +86,11 @@ class GleanMetricsServiceTest {
assertEquals(1, events[0].extra!!.size)
assertEquals("APP_ICON", events[0].extra!!["source"])
}
@Test
fun `synced tab events is correctly recorded`() {
assertFalse(SyncedTabs.syncedTabsSuggestionClicked.testHasValue())
gleanService.track(Event.SyncedTabSuggestionClicked)
assertTrue(SyncedTabs.syncedTabsSuggestionClicked.testHasValue())
}
}

@ -227,4 +227,18 @@ class MetricControllerTest {
assertEquals(controller.factToEvent(fact), Event.HaveNoTopSites)
}
@Test
fun `tracking synced tab event should be sent to enabled service`() {
val controller = ReleaseMetricController(
listOf(marketingService1),
isDataTelemetryEnabled = { true },
isMarketingDataTelemetryEnabled = { true }
)
every { marketingService1.shouldTrack(Event.SyncedTabSuggestionClicked) } returns true
controller.start(MetricServiceType.Marketing)
controller.track(Event.SyncedTabSuggestionClicked)
verify { marketingService1.track(Event.SyncedTabSuggestionClicked) }
}
}

@ -201,6 +201,7 @@ In addition to those built-in metrics, the following metrics are added to the pi
| sync_auth.sign_up |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |User registered a new Firefox Account, and was signed into it |[mozilla-mobile/fenix#4931](https://github.com/mozilla-mobile/fenix/pull/4931#issuecomment-529740300), [mozilla-mobile/fenix#15713](https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068)||2021-08-01 |1, 2 |
| sync_auth.use_email |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user chose to use their email to sign in instead of scanning a QR code, counterpart to "scan_pairing" |[mozilla-mobile/fenix#9835](https://github.com/mozilla-mobile/fenix/pull/9835#pullrequestreview-398641844), [mozilla-mobile/fenix#15713](https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068)||2021-08-01 |2 |
| sync_auth.use_email_problem |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user chose to use their email to sign in after an account problem |[mozilla-mobile/fenix#9835](https://github.com/mozilla-mobile/fenix/pull/9835#pullrequestreview-398641844), [mozilla-mobile/fenix#15713](https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068)||2021-08-01 |2 |
| synced_tabs.synced_tabs_suggestion_clicked |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |The synced tab suggestion in awesomebar was clicked. |[mozilla-mobile/fenix#18172](https://github.com/mozilla-mobile/fenix/pull/18172)||2021-08-01 |2 |
| tab.media_pause |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user pressed the pause icon on a tab from the home screen |[mozilla-mobile/fenix#5266](https://github.com/mozilla-mobile/fenix/pull/5266), [mozilla-mobile/fenix#15713](https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068)||2021-08-01 |2 |
| tab.media_play |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user pressed the play icon on a tab from the home screen |[mozilla-mobile/fenix#5266](https://github.com/mozilla-mobile/fenix/pull/5266), [mozilla-mobile/fenix#15713](https://github.com/mozilla-mobile/fenix/pull/15713#issuecomment-703972068)||2021-08-01 |2 |
| tabs.setting_opened |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |The tab settings were opened. |[mozilla-mobile/fenix#15811](https://github.com/mozilla-mobile/fenix/pull/15811#issuecomment-706402952)||2021-08-01 |2 |

Loading…
Cancel
Save