1
0
Fork 0

For #1298: Adds adjustCampaignId to core ping (#5579)

master
Sawyer Blatz 2019-09-27 08:56:33 -07:00 committed by GitHub
parent a0c60c70da
commit 7f328a6dc4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 31 additions and 1 deletions

View File

@ -410,6 +410,21 @@ metrics:
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"
adjust_campaign:
type: string
lifetime: application
description: >
A string containing the Adjust campaign ID from which the user installed Fenix
send_in_pings:
- metrics
bugs:
- 1298
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/5579
notification_emails:
- fenix-core@mozilla.com
expires: "2020-03-01"
search.default_engine:
code:

View File

@ -13,6 +13,7 @@ import com.adjust.sdk.AdjustConfig
import com.adjust.sdk.LogLevel
import org.mozilla.fenix.BuildConfig
import org.mozilla.fenix.Config
import org.mozilla.fenix.ext.settings
class AdjustMetricsService(private val application: Application) : MetricsService {
override fun start() {
@ -33,6 +34,10 @@ class AdjustMetricsService(private val application: Application) : MetricsServic
true
)
config.setOnAttributionChangedListener {
application.settings().adjustCampaignId = it.campaign
}
config.setLogLevel(LogLevel.SUPRESS)
Adjust.onCreate(config)

View File

@ -40,6 +40,7 @@ import org.mozilla.fenix.GleanMetrics.SyncAuth
import org.mozilla.fenix.GleanMetrics.Tab
import org.mozilla.fenix.GleanMetrics.TrackingProtection
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.settings
private class EventWrapper<T : Enum<T>>(
private val recorder: ((Map<T, String>?) -> Unit),
@ -444,6 +445,7 @@ class GleanMetricsService(private val context: Context) : MetricsService {
defaultMozBrowser.set(it)
}
mozillaProducts.set(MozillaProductDetector.getInstalledMozillaProducts(context))
adjustCampaign.set(context.settings().adjustCampaignId)
}
SearchDefaultEngine.apply {

View File

@ -23,8 +23,8 @@ import org.mozilla.fenix.Config
import org.mozilla.fenix.R
import org.mozilla.fenix.components.metrics.MozillaProductDetector
import org.mozilla.fenix.ext.getPreferenceKey
import org.mozilla.fenix.settings.deletebrowsingdata.DeleteBrowsingDataOnQuitType
import org.mozilla.fenix.settings.PhoneFeature
import org.mozilla.fenix.settings.deletebrowsingdata.DeleteBrowsingDataOnQuitType
import java.security.InvalidParameterException
/**
@ -76,6 +76,11 @@ class Settings private constructor(
override val preferences: SharedPreferences =
appContext.getSharedPreferences(FENIX_PREFERENCES, MODE_PRIVATE)
var adjustCampaignId by stringPreference(
appContext.getPreferenceKey(R.string.pref_key_adjust_campaign),
default = ""
)
var usePrivateMode by booleanPreference(
appContext.getPreferenceKey(R.string.pref_key_private_mode),
default = false

View File

@ -104,4 +104,6 @@
<!-- Quick Action Sheet -->
<string name="pref_key_bounce_quick_action" translatable="false">pref_key_bounce_quick_action</string>
<string name="pref_key_reader_mode_notification" translatable="false">pref_key_reader_mode_notification</string>
<string name="pref_key_adjust_campaign" translatable="false">pref_key_adjust_campaign</string>
</resources>

File diff suppressed because one or more lines are too long