2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-03 23:15:31 +00:00

for #11830 added new metric for collecting startup method from all startup phases (#11940)

* for #11830 added new metric for collecting startup method

move all source startup telemetry into its own logic and added an UNKOWN state

* switched back to onNewIntent solution

* renamed the metric
This commit is contained in:
Sachin 2020-06-26 17:38:08 -07:00 committed by GitHub
parent 61b1b5a895
commit 4b9cc954fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 63 additions and 2 deletions

View File

@ -8,6 +8,32 @@ no_lint:
- CATEGORY_GENERIC
events:
app_received_intent:
type: event
description: |
The system received an Intent for the HomeActivity. An intent
is received an external entity wants to the app to display
content. Intents can be received when the app is closed at
which point the app will be opened or when the app is
already opened at which point the already open app will make
changes such as loading a url. This can be used loosely as a
heuristic for when the user requested to open the app. The
HomeActivity encompasses the home screen and browser screen but
may include other screens. This differs from the app_opened
probe because it measures all startups, not just cold startup.
extra_keys:
source:
description: |
The method used to open Fenix. Possible values are `app_icon`,
`custom_tab`, `link` or `unknown`
bugs:
- https://github.com/mozilla-mobile/fenix/issues/11830
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/11940/
notification_emails:
- esmyth@mozilla.com
- perf-android-fe@mozilla.com
expires: "2020-12-01"
app_opened:
type: event
description: |

View File

@ -174,10 +174,14 @@ open class HomeActivity : LocaleAwareAppCompatActivity() {
lifecycle.addObserver(BreadcrumbsRecorder(components.analytics.crashReporter,
navHost.navController, ::getBreadcrumbMessage))
intent
?.toSafeIntent()
val safeIntent = intent?.toSafeIntent()
safeIntent
?.let(::getIntentSource)
?.also { components.analytics.metrics.track(Event.OpenedApp(it)) }
// record on cold startup
safeIntent
?.let(::getIntentAllSource)
?.also { components.analytics.metrics.track(Event.AppRecievedIntent(it)) }
}
supportActionBar?.hide()
@ -250,6 +254,15 @@ open class HomeActivity : LocaleAwareAppCompatActivity() {
?.let { it as? TabTrayDialogFragment }
?.also { it.dismissAllowingStateLoss() }
}
// If there is a warm or hot startup, onNewIntent method is always called first.
// Note: This does not work in case of an user sending an intent with ACTION_VIEW
// for example, launch the application, and than use adb to send an intent with
// ACTION_VIEW to open a link. In this case, we will get multiple telemetry events.
intent
.toSafeIntent()
.let(::getIntentAllSource)
?.also { components.analytics.metrics.track(Event.AppRecievedIntent(it)) }
}
/**
@ -320,6 +333,14 @@ open class HomeActivity : LocaleAwareAppCompatActivity() {
}
}
protected open fun getIntentAllSource(intent: SafeIntent): Event.AppRecievedIntent.Source? {
return when {
intent.isLauncherIntent -> Event.AppRecievedIntent.Source.APP_ICON
intent.action == Intent.ACTION_VIEW -> Event.AppRecievedIntent.Source.LINK
else -> Event.AppRecievedIntent.Source.UNKNOWN
}
}
/**
* External sources such as 3rd party links and shortcuts use this function to enter
* private mode directly before the content view is created. Returns the mode set by the intent

View File

@ -97,6 +97,10 @@ private val Event.wrapper: EventWrapper<*>?
{ Events.appOpened.record(it) },
{ Events.appOpenedKeys.valueOf(it) }
)
is Event.AppRecievedIntent -> EventWrapper(
{ Events.appReceivedIntent.record(it) },
{ Events.appReceivedIntentKeys.valueOf(it) }
)
is Event.SearchBarTapped -> EventWrapper(
{ Events.searchBarTapped.record(it) },
{ Events.searchBarTappedKeys.valueOf(it) }

View File

@ -309,6 +309,13 @@ sealed class Event {
get() = hashMapOf(Events.appOpenedKeys.source to source.name)
}
data class AppRecievedIntent(val source: Source) : Event() {
enum class Source { APP_ICON, LINK, CUSTOM_TAB, UNKNOWN }
override val extras: Map<Events.appReceivedIntentKeys, String>?
get() = hashMapOf(Events.appReceivedIntentKeys.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

@ -41,6 +41,8 @@ open class ExternalAppBrowserActivity : HomeActivity() {
final override fun getIntentSource(intent: SafeIntent) = Event.OpenedApp.Source.CUSTOM_TAB
final override fun getIntentAllSource(intent: SafeIntent) = Event.AppRecievedIntent.Source.CUSTOM_TAB
final override fun getIntentSessionId(intent: SafeIntent) = intent.getSessionId()
override fun getNavDirections(

View File

@ -100,6 +100,7 @@ The following metrics are added to the ping:
| download_notification.try_again |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user tapped on try again when a download fails in the download notification |[1](https://github.com/mozilla-mobile/fenix/pull/6554)||2020-09-01 |
| error_page.visited_error |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user encountered an error page |[1](https://github.com/mozilla-mobile/fenix/pull/2491#issuecomment-492414486)|<ul><li>error_type: The error type of the error page encountered</li></ul>|2020-09-01 |
| events.app_opened |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user opened the app (from cold start, to the homescreen or browser) |[1](https://github.com/mozilla-mobile/fenix/pull/1067#issuecomment-474598673)|<ul><li>source: The method used to open Fenix. Possible values are: `app_icon`, `custom_tab` or `link` </li></ul>|2020-09-01 |
| events.app_opened_all_startup |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user opened the app to the HomeActivity. The HomeActivity encompasses the home screen and browser screen but may include other screens. This differs from the app_opened probe because it measures all startups, not just cold startup. |[1](https://github.com/mozilla-mobile/fenix/pull/11940/)|<ul><li>source: The method used to open Fenix. Possible values are `app_icon`, `custom_tab`, `link` or `unknown` </li></ul>|2020-12-01 |
| events.browser_menu_action |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A browser menu item was tapped |[1](https://github.com/mozilla-mobile/fenix/pull/1214#issue-264756708), [2](https://github.com/mozilla-mobile/fenix/pull/5098#issuecomment-529658996), [3](https://github.com/mozilla-mobile/fenix/pull/6310)|<ul><li>item: A string containing the name of the item the user tapped. These items include: Settings, Help, Desktop Site toggle on/off, Find in Page, New Tab, Private Tab, Share, Report Site Issue, Back/Forward button, Reload Button, Quit, Reader Mode On, Reader Mode Off, Open In app, Add To Top Sites, Add-ons Manager, Bookmarks, History </li></ul>|2020-09-01 |
| events.entered_url |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user entered a url |[1](https://github.com/mozilla-mobile/fenix/pull/1067#issuecomment-474598673)|<ul><li>autocomplete: A boolean that tells us whether the URL was autofilled by an Autocomplete suggestion </li></ul>|2020-09-01 |
| events.opened_link |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user opened a link with Fenix |[1](https://github.com/mozilla-mobile/fenix/pull/5975)|<ul><li>mode: The mode the link was opened in. Either 'PRIVATE' or 'NORMAL'. </li></ul>|2020-09-01 |