1
0
Fork 0

For #5021: Adds telemetry for what's new button

master
Sawyer Blatz 2019-09-04 08:57:59 -07:00 committed by Jeff Boek
parent 3c07cacf4d
commit f7dde41b3b
4 changed files with 15 additions and 0 deletions

View File

@ -330,6 +330,10 @@ private val Event.wrapper: EventWrapper<*>?
is Event.PrivateBrowsingNotificationDeleteAndOpenTapped -> EventWrapper<NoExtraKeys>(
{ PrivateBrowsingMode.notificationDelete.record(it) }
)
is Event.WhatsNewTapped -> EventWrapper(
{ Events.whatsNewTapped.record(it) },
{ Events.whatsNewTappedKeys.valueOf(it) }
)
// Don't record other events in Glean:
is Event.AddBookmark -> null

View File

@ -130,6 +130,12 @@ sealed class Event {
get() = hashMapOf(Events.appOpenedKeys.source to source.name)
}
data class WhatsNewTapped(val source: Source) : Event() {
enum class Source { ABOUT, HOME }
override val extras: Map<Events.whatsNewTappedKeys, String>?
get() = hashMapOf(Events.whatsNewTappedKeys.source to source.name)
}
data class CollectionSaveButtonPressed(val fromScreen: String) : Event() {
override val extras: Map<Collections.saveButtonKeys, String>?
get() = mapOf(Collections.saveButtonKeys.fromScreen to fromScreen)

View File

@ -59,6 +59,7 @@ import org.mozilla.fenix.collections.SaveCollectionStep
import org.mozilla.fenix.components.FenixSnackbar
import org.mozilla.fenix.components.TabCollectionStorage
import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.ext.metrics
import org.mozilla.fenix.ext.nav
import org.mozilla.fenix.ext.requireComponents
import org.mozilla.fenix.ext.sessionsOfType
@ -578,6 +579,7 @@ class HomeFragment : Fragment(), AccountObserver {
invokePendingDeleteJobs()
hideOnboardingIfNeeded()
WhatsNew.userViewedWhatsNew(context!!)
context!!.metrics.track(Event.WhatsNewTapped(Event.WhatsNewTapped.Source.HOME))
(activity as HomeActivity).openToBrowserAndLoad(
searchTermOrURL = SupportUtils.getSumoURLForTopic(
context!!,

View File

@ -21,6 +21,8 @@ import org.mozilla.fenix.BrowserDirection
import org.mozilla.fenix.BuildConfig
import org.mozilla.fenix.HomeActivity
import org.mozilla.fenix.R
import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.ext.metrics
import org.mozilla.fenix.whatsnew.WhatsNew
import org.mozilla.geckoview.BuildConfig as GeckoViewBuildConfig
@ -77,6 +79,7 @@ class AboutFragment : Fragment() {
with(whats_new_button) {
text = getString(R.string.about_whats_new, getString(R.string.app_name))
setOnClickListener {
context.metrics.track(Event.WhatsNewTapped(Event.WhatsNewTapped.Source.ABOUT))
WhatsNew.userViewedWhatsNew(context!!)
(activity as HomeActivity).openToBrowserAndLoad(
searchTermOrURL = SupportUtils.getSumoURLForTopic(