mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-03 23:15:31 +00:00
[fenix] For mozilla-mobilehttps://github.com/mozilla-mobile/fenix/issues/8172: Add a new 'E_Fennec_To_Fenix_Migrated' Leanplum event
This new event will be sent when the user has successfully migrated from Fennec to Fenix. This event will only be sent to Leanplum and not to the other telemetry services like Glean or Adjust. Co-authored-by: ValentinTimisica <valentin.timisica@softvision.ro>
This commit is contained in:
parent
7d0ec138cd
commit
673fca0d49
@ -494,6 +494,7 @@ private val Event.wrapper: EventWrapper<*>?
|
|||||||
is Event.InteractWithSearchURLArea -> null
|
is Event.InteractWithSearchURLArea -> null
|
||||||
is Event.ClearedPrivateData -> null
|
is Event.ClearedPrivateData -> null
|
||||||
is Event.DismissedOnboarding -> null
|
is Event.DismissedOnboarding -> null
|
||||||
|
is Event.FennecToFenixMigrated -> null
|
||||||
}
|
}
|
||||||
|
|
||||||
class GleanMetricsService(private val context: Context) : MetricsService {
|
class GleanMetricsService(private val context: Context) : MetricsService {
|
||||||
|
@ -30,6 +30,7 @@ private val Event.name: String?
|
|||||||
is Event.SyncAuthSignOut -> "E_Sign_Out_FxA"
|
is Event.SyncAuthSignOut -> "E_Sign_Out_FxA"
|
||||||
is Event.ClearedPrivateData -> "E_Cleared_Private_Data"
|
is Event.ClearedPrivateData -> "E_Cleared_Private_Data"
|
||||||
is Event.DismissedOnboarding -> "E_Dismissed_Onboarding"
|
is Event.DismissedOnboarding -> "E_Dismissed_Onboarding"
|
||||||
|
is Event.FennecToFenixMigrated -> "E_Fennec_To_Fenix_Migrated"
|
||||||
|
|
||||||
// Do not track other events in Leanplum
|
// Do not track other events in Leanplum
|
||||||
else -> ""
|
else -> ""
|
||||||
|
@ -149,6 +149,7 @@ sealed class Event {
|
|||||||
object RightsTapped : Event()
|
object RightsTapped : Event()
|
||||||
object LicensingTapped : Event()
|
object LicensingTapped : Event()
|
||||||
object LibrariesThatWeUseTapped : Event()
|
object LibrariesThatWeUseTapped : Event()
|
||||||
|
object FennecToFenixMigrated : Event()
|
||||||
|
|
||||||
// Interaction events with extras
|
// Interaction events with extras
|
||||||
|
|
||||||
|
@ -0,0 +1,32 @@
|
|||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
package org.mozilla.fenix
|
||||||
|
|
||||||
|
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||||
|
import kotlinx.coroutines.flow.collect
|
||||||
|
import mozilla.components.lib.state.ext.flowScoped
|
||||||
|
import mozilla.components.support.base.log.logger.Logger
|
||||||
|
import mozilla.components.support.migration.state.MigrationProgress
|
||||||
|
import mozilla.components.support.migration.state.MigrationStore
|
||||||
|
import org.mozilla.fenix.components.metrics.Event
|
||||||
|
import org.mozilla.fenix.components.metrics.MetricController
|
||||||
|
|
||||||
|
class MigrationTelemetryListener(
|
||||||
|
private val metrics: MetricController,
|
||||||
|
private val store: MigrationStore
|
||||||
|
) {
|
||||||
|
@UseExperimental(ExperimentalCoroutinesApi::class)
|
||||||
|
fun start() {
|
||||||
|
// Observe for migration completed.
|
||||||
|
store.flowScoped { flow ->
|
||||||
|
flow.collect { state ->
|
||||||
|
Logger("MigrationTelemetryListener").debug("Migration state: ${state.progress}")
|
||||||
|
if (state.progress == MigrationProgress.COMPLETED) {
|
||||||
|
metrics.track(Event.FennecToFenixMigrated)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -42,6 +42,13 @@ class MigratingFenixApplication : FenixApplication() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val migrationTelemetryListener by lazy {
|
||||||
|
MigrationTelemetryListener(
|
||||||
|
components.analytics.metrics,
|
||||||
|
components.migrationStore
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
override fun setupInMainProcessOnly() {
|
override fun setupInMainProcessOnly() {
|
||||||
// These migrations need to run before regular initialization happens.
|
// These migrations need to run before regular initialization happens.
|
||||||
migrateBlocking()
|
migrateBlocking()
|
||||||
@ -55,6 +62,7 @@ class MigratingFenixApplication : FenixApplication() {
|
|||||||
|
|
||||||
// The rest of the migrations can happen now.
|
// The rest of the migrations can happen now.
|
||||||
migrationPushSubscriber.start()
|
migrationPushSubscriber.start()
|
||||||
|
migrationTelemetryListener.start()
|
||||||
migrator.startMigrationIfNeeded(components.migrationStore, MigrationService::class.java)
|
migrator.startMigrationIfNeeded(components.migrationStore, MigrationService::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,6 +226,11 @@ Here is the list of current Events sent, which can be found here in the code bas
|
|||||||
<td>The user finished onboarding. Could be triggered by pressing "start browsing," opening settings, or invoking a search.</td>
|
<td>The user finished onboarding. Could be triggered by pressing "start browsing," opening settings, or invoking a search.</td>
|
||||||
<td><a href="https://github.com/mozilla-mobile/fenix/pull/3459#issuecomment-502191109">#3459</a></td>
|
<td><a href="https://github.com/mozilla-mobile/fenix/pull/3459#issuecomment-502191109">#3459</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>`E_Fennec_To_Fenix_Migrated`</td>
|
||||||
|
<td>The user has just migrated from Fennec to Fenix.</td>
|
||||||
|
<td><a href="https://github.com/mozilla-mobile/fenix/pull/8208#issuecomment-584040440">#8208</a></td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
Deep links
|
Deep links
|
||||||
|
Loading…
Reference in New Issue
Block a user