For #7295 - Adds more documentation for the installation metrics
parent
0056fc7e15
commit
7aeb5f072d
|
@ -1796,11 +1796,11 @@ installation:
|
|||
send_in_pings:
|
||||
- installation
|
||||
description: >
|
||||
Campaign
|
||||
The name of the campaign that is responsible for this installation.
|
||||
bugs:
|
||||
- https://github.com/mozilla-mobile/fenix/issues/7295
|
||||
data_reviews:
|
||||
- TODO
|
||||
- https://github.com/mozilla-mobile/fenix/pull/8074#issuecomment-586512202
|
||||
notification_emails:
|
||||
- fenix-core@mozilla.com
|
||||
expires: "2020-09-01"
|
||||
|
@ -1809,11 +1809,11 @@ installation:
|
|||
send_in_pings:
|
||||
- installation
|
||||
description: >
|
||||
Network
|
||||
The name of the Network that sourced this installation.
|
||||
bugs:
|
||||
- https://github.com/mozilla-mobile/fenix/issues/7295
|
||||
data_reviews:
|
||||
- TODO
|
||||
- https://github.com/mozilla-mobile/fenix/pull/8074#issuecomment-586512202
|
||||
notification_emails:
|
||||
- fenix-core@mozilla.com
|
||||
expires: "2020-09-01"
|
||||
|
@ -1822,11 +1822,11 @@ installation:
|
|||
send_in_pings:
|
||||
- installation
|
||||
description: >
|
||||
AdGroup
|
||||
The name of the AdGroup that was used to source this installation.
|
||||
bugs:
|
||||
- https://github.com/mozilla-mobile/fenix/issues/7295
|
||||
- https://github.com/mozilla-mobile/fenix/pull/8074#issuecomment-586512202
|
||||
data_reviews:
|
||||
- TODO
|
||||
- https://github.com/mozilla-mobile/fenix/pull/8074#issuecomment-586480836
|
||||
notification_emails:
|
||||
- fenix-core@mozilla.com
|
||||
expires: "2020-09-01"
|
||||
|
@ -1835,24 +1835,24 @@ installation:
|
|||
- installation
|
||||
type: string
|
||||
description: >
|
||||
Creative
|
||||
The identifier of the creative material that the user interacted with.
|
||||
bugs:
|
||||
- https://github.com/mozilla-mobile/fenix/issues/7295
|
||||
data_reviews:
|
||||
- TODO
|
||||
- https://github.com/mozilla-mobile/fenix/pull/8074#issuecomment-586512202
|
||||
notification_emails:
|
||||
- fenix-core@mozilla.com
|
||||
expires: "2020-09-01"
|
||||
timestamp:
|
||||
send_in_pings:
|
||||
- installation
|
||||
type: string
|
||||
type: datetime
|
||||
description: >
|
||||
Timestamp
|
||||
The date and time of the installation.
|
||||
bugs:
|
||||
- https://github.com/mozilla-mobile/fenix/issues/7295
|
||||
data_reviews:
|
||||
- TODO
|
||||
- https://github.com/mozilla-mobile/fenix/pull/8074#issuecomment-586512202
|
||||
notification_emails:
|
||||
- fenix-core@mozilla.com
|
||||
expires: "2020-09-01"
|
||||
|
|
|
@ -21,11 +21,11 @@ activation:
|
|||
|
||||
installation:
|
||||
description: >
|
||||
Intended for counting user installs.
|
||||
This ping is intended to capture the source of the installation
|
||||
include_client_id: false
|
||||
bugs:
|
||||
- https://github.com/mozilla-mobile/fenix/issues/7295
|
||||
data_reviews:
|
||||
- TODO
|
||||
- https://github.com/mozilla-mobile/fenix/pull/8074#issuecomment-586512202
|
||||
notification_emails:
|
||||
- fenix-core@mozilla.com
|
||||
- fenix-core@mozilla.com
|
||||
|
|
|
@ -54,10 +54,7 @@ class AdjustMetricsService(private val application: Application) : MetricsServic
|
|||
application.applicationContext.settings().adjustCampaignId =
|
||||
it.campaign
|
||||
}
|
||||
if (application.applicationContext.settings().adjustInstallTimestamp.isEmpty()) {
|
||||
application.applicationContext.settings().adjustInstallTimestamp =
|
||||
System.currentTimeMillis().toString()
|
||||
}
|
||||
|
||||
InstallationPing(application).checkAndSend()
|
||||
}
|
||||
|
||||
|
|
|
@ -54,13 +54,15 @@ class InstallationPing(private val context: Context) {
|
|||
*/
|
||||
@VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
|
||||
internal fun triggerPing() {
|
||||
if (checkMetricsNotEmpty()
|
||||
) {
|
||||
Installation.campaign.set(context.settings().adjustCampaignId)
|
||||
Installation.adgroup.set(context.settings().adjustAdGroup)
|
||||
Installation.creative.set(context.settings().adjustCreative)
|
||||
Installation.network.set(context.settings().adjustNetwork)
|
||||
Installation.timestamp.set(context.settings().adjustInstallTimestamp)
|
||||
if (checkMetricsNotEmpty()) {
|
||||
context.settings().also {
|
||||
Installation.campaign.set(it.adjustCampaignId)
|
||||
Installation.adgroup.set(it.adjustAdGroup)
|
||||
Installation.creative.set(it.adjustCreative)
|
||||
Installation.network.set(it.adjustNetwork)
|
||||
Installation.timestamp.set()
|
||||
}
|
||||
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
Pings.installation.submit()
|
||||
markAsTriggered()
|
||||
|
|
|
@ -110,11 +110,6 @@ class Settings private constructor(
|
|||
default = ""
|
||||
)
|
||||
|
||||
var adjustInstallTimestamp by stringPreference(
|
||||
appContext.getPreferenceKey(R.string.pref_key_adjust_install_timestamp),
|
||||
default = ""
|
||||
)
|
||||
|
||||
var openLinksInAPrivateTab by booleanPreference(
|
||||
appContext.getPreferenceKey(R.string.pref_key_open_links_in_a_private_tab),
|
||||
default = false
|
||||
|
|
|
@ -12,20 +12,14 @@ import io.mockk.mockk
|
|||
import io.mockk.mockkStatic
|
||||
import io.mockk.spyk
|
||||
import io.mockk.verify
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import kotlinx.coroutines.test.runBlockingTest
|
||||
import org.junit.Test
|
||||
import org.mozilla.fenix.TestApplication
|
||||
import org.mozilla.fenix.ext.settings
|
||||
import org.mozilla.fenix.utils.Settings
|
||||
import org.robolectric.annotation.Config
|
||||
|
||||
@ExperimentalCoroutinesApi
|
||||
@Config(application = TestApplication::class)
|
||||
internal class InstallationPingTest {
|
||||
|
||||
@Test
|
||||
fun `checkAndSend() triggers the ping if it wasn't marked as triggered`() = runBlockingTest {
|
||||
fun `checkAndSend() triggers the ping if it wasn't marked as triggered`() {
|
||||
val mockedContext: Context = mockk(relaxed = true)
|
||||
val mockedSettings: Settings = mockk(relaxed = true)
|
||||
mockkStatic("org.mozilla.fenix.ext.ContextKt")
|
||||
|
@ -40,7 +34,7 @@ internal class InstallationPingTest {
|
|||
verify(exactly = 1) { mockAp.triggerPing() }
|
||||
// Marking the ping as triggered happens in a co-routine off the main thread,
|
||||
// so wait a bit for it.
|
||||
verify(exactly = 1) { mockAp.markAsTriggered() }
|
||||
verify(timeout = 5000, exactly = 1) { mockAp.markAsTriggered() }
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -171,17 +171,17 @@ The following metrics are added to the ping:
|
|||
| user_specified_search_engines.custom_engine_deleted |[event](https://mozilla.github.io/glean/book/user/metrics/event.html) |A user deleted a custom search engine |[1](https://github.com/mozilla-mobile/fenix/pull/6918)||2020-09-01 |
|
||||
|
||||
## installation
|
||||
Intended for counting user installs.
|
||||
This ping is intended to capture the source of the installation
|
||||
|
||||
The following metrics are added to the ping:
|
||||
|
||||
| Name | Type | Description | Data reviews | Extras | Expiration |
|
||||
| --- | --- | --- | --- | --- | --- |
|
||||
| installation.adgroup |[string](https://mozilla.github.io/glean/book/user/metrics/string.html) |AdGroup |[1](TODO)||2020-09-01 |
|
||||
| installation.campaign |[string](https://mozilla.github.io/glean/book/user/metrics/string.html) |Campaign |[1](TODO)||2020-09-01 |
|
||||
| installation.creative |[string](https://mozilla.github.io/glean/book/user/metrics/string.html) |Creative |[1](TODO)||2020-09-01 |
|
||||
| installation.network |[string](https://mozilla.github.io/glean/book/user/metrics/string.html) |Network |[1](TODO)||2020-09-01 |
|
||||
| installation.timestamp |[string](https://mozilla.github.io/glean/book/user/metrics/string.html) |Timestamp |[1](TODO)||2020-09-01 |
|
||||
| installation.adgroup |[string](https://mozilla.github.io/glean/book/user/metrics/string.html) |The name of the AdGroup that was used to source this installation. |[1](https://github.com/mozilla-mobile/fenix/pull/8074#issuecomment-586480836)||2020-09-01 |
|
||||
| installation.campaign |[string](https://mozilla.github.io/glean/book/user/metrics/string.html) |The name of the campaign that is responsible for this installation. |[1](https://github.com/mozilla-mobile/fenix/pull/8074#issuecomment-586512202)||2020-09-01 |
|
||||
| installation.creative |[string](https://mozilla.github.io/glean/book/user/metrics/string.html) |The identifier of the creative material that the user interacted with. |[1](https://github.com/mozilla-mobile/fenix/pull/8074#issuecomment-586512202)||2020-09-01 |
|
||||
| installation.network |[string](https://mozilla.github.io/glean/book/user/metrics/string.html) |The name of the Network that sourced this installation. |[1](https://github.com/mozilla-mobile/fenix/pull/8074#issuecomment-586512202)||2020-09-01 |
|
||||
| installation.timestamp |[datetime](https://mozilla.github.io/glean/book/user/metrics/datetime.html) |The date and time of the installation. |[1](https://github.com/mozilla-mobile/fenix/pull/8074#issuecomment-586512202)||2020-09-01 |
|
||||
|
||||
## metrics
|
||||
This is a built-in ping that is assembled out of the box by the Glean SDK.
|
||||
|
|
Loading…
Reference in New Issue