Skip to content

Commit

Permalink
For mozilla-mobile#6834: Adds telemetry for About page items
Browse files Browse the repository at this point in the history
Didn't change the existing probe for 'whats new' item because we're already
collecting that info.
  • Loading branch information
ValentinTimisica committed Feb 3, 2020
1 parent eb2eed1 commit a9cd6d4
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 3 deletions.
57 changes: 57 additions & 0 deletions app/metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1703,3 +1703,60 @@ top_sites:
notification_emails:
- fenix-core@mozilla.com
expires: "2020-09-01"

about_page:
support_tapped:
type: event
description: >
A user tapped on "Support" item from About page
bugs:
- https://github.com/mozilla-mobile/fenix/issues/6834
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/6834
notification_emails:
- fenix-core@mozilla.com
expires: "2020-09-01"
privacy_notice_tapped:
type: event
description: >
A user tapped on "Privacy notice" item from About page
bugs:
- https://github.com/mozilla-mobile/fenix/issues/6834
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/6834
notification_emails:
- fenix-core@mozilla.com
expires: "2020-09-01"
rights_tapped:
type: event
description: >
A user tapped on "Know your rights" item from About page
bugs:
- https://github.com/mozilla-mobile/fenix/issues/6834
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/6834
notification_emails:
- fenix-core@mozilla.com
expires: "2020-09-01"
licensing_tapped:
type: event
description: >
A user tapped on "Licensing information" item from About page
bugs:
- https://github.com/mozilla-mobile/fenix/issues/6834
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/6834
notification_emails:
- fenix-core@mozilla.com
expires: "2020-09-01"
libraries_tapped:
type: event
description: >
A user tapped on "Libraries that we use" item from About page
bugs:
- https://github.com/mozilla-mobile/fenix/issues/6834
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/6834
notification_emails:
- fenix-core@mozilla.com
expires: "2020-09-01"
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import kotlinx.coroutines.MainScope
import mozilla.components.service.glean.Glean
import mozilla.components.service.glean.private.NoExtraKeys
import mozilla.components.support.base.log.logger.Logger
import org.mozilla.fenix.GleanMetrics.AboutPage
import org.mozilla.fenix.GleanMetrics.BookmarksManagement
import org.mozilla.fenix.GleanMetrics.Collections
import org.mozilla.fenix.GleanMetrics.ContextMenu
Expand Down Expand Up @@ -466,6 +467,21 @@ private val Event.wrapper: EventWrapper<*>?
is Event.TopSiteRemoved -> EventWrapper<NoExtraKeys>(
{ TopSites.remove.record(it) }
)
is Event.SupportTapped -> EventWrapper<NoExtraKeys>(
{ AboutPage.supportTapped.record(it) }
)
is Event.PrivacyNoticeTapped -> EventWrapper<NoExtraKeys>(
{ AboutPage.privacyNoticeTapped.record(it) }
)
is Event.RightsTapped -> EventWrapper<NoExtraKeys>(
{ AboutPage.rightsTapped.record(it) }
)
is Event.LicensingTapped -> EventWrapper<NoExtraKeys>(
{ AboutPage.licensingTapped.record(it) }
)
is Event.LibrariesThatWeUseTapped -> EventWrapper<NoExtraKeys>(
{ AboutPage.librariesTapped.record(it) }
)
// Don't record other events in Glean:
is Event.AddBookmark -> null
is Event.OpenedBookmark -> null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ sealed class Event {
object CustomEngineDeleted : Event()
object PrivateBrowsingShowSearchSuggestions : Event()
object WhatsNewTapped : Event()
object SupportTapped : Event()
object PrivacyNoticeTapped : Event()
object RightsTapped : Event()
object LicensingTapped : Event()
object LibrariesThatWeUseTapped : Event()

// Interaction events with extras

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,29 @@ class AboutFragment : Fragment(), AboutPageListener {
override fun onAboutItemClicked(item: AboutItem) {
Do exhaustive when (item) {
is AboutItem.ExternalLink -> {
if (item.type == WHATS_NEW) {
WhatsNew.userViewedWhatsNew(requireContext())
requireComponents.analytics.metrics.track(Event.WhatsNewTapped)
when (item.type) {
WHATS_NEW -> {
WhatsNew.userViewedWhatsNew(requireContext())
requireComponents.analytics.metrics.track(Event.WhatsNewTapped)
}
SUPPORT -> {
requireComponents.analytics.metrics.track(Event.SupportTapped)
}
PRIVACY_NOTICE -> {
requireComponents.analytics.metrics.track(Event.PrivacyNoticeTapped)
}
RIGHTS -> {
requireComponents.analytics.metrics.track(Event.RightsTapped)
}
LICENSING_INFO -> {
requireComponents.analytics.metrics.track(Event.LicensingTapped)
}
}

openLinkInCustomTab(item.url)
}
is AboutItem.Libraries -> {
requireComponents.analytics.metrics.track(Event.LibrariesThatWeUseTapped)
openLibrariesPage()
}
}
Expand Down
5 changes: 5 additions & 0 deletions docs/metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ The following metrics are added to the ping:

| Name | Type | Description | Data reviews | Extras | Expiration |
| --- | --- | --- | --- | --- | --- |
| about_page.libraries_tapped |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user tapped on "Libraries that we use" item from About page |[1](https://github.com/mozilla-mobile/fenix/pull/6834)||2020-09-01 |
| about_page.licensing_tapped |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user tapped on "Licensing information" item from About page |[1](https://github.com/mozilla-mobile/fenix/pull/6834)||2020-09-01 |
| about_page.privacy_notice_tapped |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user tapped on "Privacy notice" item from About page |[1](https://github.com/mozilla-mobile/fenix/pull/6834)||2020-09-01 |
| about_page.rights_tapped |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user tapped on "Know your rights" item from About page |[1](https://github.com/mozilla-mobile/fenix/pull/6834)||2020-09-01 |
| about_page.support_tapped |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user tapped on "Support" item from About page |[1](https://github.com/mozilla-mobile/fenix/pull/6834)||2020-09-01 |
| bookmarks_management.copied |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user copied a bookmark. |[1](https://github.com/mozilla-mobile/fenix/pull/1708)||2020-09-01 |
| bookmarks_management.edited |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user edited the title and/or URL of an existing bookmark. |[1](https://github.com/mozilla-mobile/fenix/pull/1708)||2020-09-01 |
| bookmarks_management.folder_add |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user added a new bookmark folder. |[1](https://github.com/mozilla-mobile/fenix/pull/1708)||2020-09-01 |
Expand Down

0 comments on commit a9cd6d4

Please sign in to comment.