Bug 1823492 - Add timespan metric for Adjust attribution (#2982)

(cherry picked from commit 385295d1e938301af6115d036641ce7e11d27874)

Co-authored-by: Roger Yang <royang@mozilla.com>
fenix/116.0
mergify[bot] 10 months ago committed by GitHub
parent 8298f3ba98
commit ae224354ee

@ -7153,6 +7153,28 @@ first_session:
tags:
- Performance
- Attribution
adjust_attribution_timespan:
type: timespan
time_unit: millisecond
send_in_pings:
- first-session
- metrics
description: >
The time that it takes to derive the attribution parameters by
the Adjust SDK.
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1823492
data_reviews:
- https://github.com/mozilla-mobile/firefox-android/pull/2974
data_sensitivity:
- technical
notification_emails:
- android-probes@mozilla.com
expires: 124
metadata:
tags:
- Performance
- Attribution
play_store_attribution:
source:
type: string

@ -51,8 +51,13 @@ class AdjustMetricsService(
val installationPing = FirstSessionPing(application)
FirstSession.adjustAttributionTimespan.start()
val timerId = FirstSession.adjustAttributionTime.start()
config.setOnAttributionChangedListener {
if (!installationPing.wasAlreadyTriggered()) {
FirstSession.adjustAttributionTimespan.stop()
}
FirstSession.adjustAttributionTime.stopAndAccumulate(timerId)
if (!it.network.isNullOrEmpty()) {
application.applicationContext.settings().adjustNetwork =
@ -81,6 +86,7 @@ class AdjustMetricsService(
}
override fun stop() {
FirstSession.adjustAttributionTimespan.cancel()
Adjust.setEnabled(false)
Adjust.gdprForgetMe(application.applicationContext)
}

@ -35,7 +35,6 @@ class FirstSessionPing(private val context: Context) {
*
* @return true if it was already triggered, false otherwise.
*/
@VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
internal fun wasAlreadyTriggered(): Boolean {
return prefs.getBoolean("ping_sent", false)
}

Loading…
Cancel
Save