Importing attributions on Android
To set up import, call the attribution retrieval method on the client, then call the attribution sending method AppMetrica.reportExternalAttribution
in the АppMetrica SDK.
AppsFlyer
- Register
AppsflyerConversionListener
. - Set up the sending of attribution data (the
AppMetrica.reportExternalAttribution
method) in the AppMetrica SDK fromAppsflyerConversionListener
.
Kotlin
Java
val appsflyerConversionListener = object : AppsFlyerConversionListener {
// ...
override fun onConversionDataSuccess(value: MutableMap<String, Any>?) {
AppMetrica.reportExternalAttribution(ExternalAttributions.appsflyer(value))
}
// ...
}
AppsFlyerLib.getInstance().init(appsflyerKey, appsFlyerConversionListener, context)
AppsFlyerConversionListener appsFlyerConversionListener = new AppsFlyerConversionListener() {
// ...
@Override
public void onConversionDataSuccess(Map<String, Object> value) {
AppMetrica.reportExternalAttribution(ExternalAttributions.appsflyer(value));
}
// ....
};
AppsFlyerLib.getInstance().init(appsflyerKey, appsFlyerConversionListener, context);
Adjust
- Register
OnAttributionChangedListener
. - Set up the sending of attribution data (the
AppMetrica.reportExternalAttribution
method) in the AppMetrica SDK fromOnAttributionChangedListener
.
Kotlin
Java
val config = AdjustConfig(context, adjustToken, adjustEnvironment)
config.setOnAttributionChangedListener { attribution ->
AppMetrica.reportExternalAttribution(ExternalAttributions.adjust(attribution))
}
Adjust.onCreate(config)
AdjustConfig config = new AdjustConfig(context, adjustToken, adjustEnvironment);
config.setOnAttributionChangedListener(attribution -> {
// ...
AppMetrica.reportExternalAttribution(ExternalAttributions.adjust(attribution));
// ...
});
Adjust.onCreate(config);
Kochava
- Make an asynchronous attribution request by calling
Tracker#retrieveInstallAttribution()
. - Set up the sending of attribution data (the
AppMetrica.reportExternalAttribution
method) in the AppMetrica SDK fromRetrievedInstallAttributionListener
.
Kotlin
Java
Tracker.getInstance().retrieveInstallAttribution { installAttribution ->
AppMetrica.reportExternalAttribution(ExternalAttributions.kochava(installAttribution.toJson()))
}
Tracker.getInstance().retrieveInstallAttribution(installAttribution ->
AppMetrica.reportExternalAttribution(ExternalAttributions.kochava(installAttribution.toJson()))
);
Tenjin
- Make an asynchronous attribution request by calling
TenjinSDK#getAttributionInfo
. - Set up the sending of attribution data (the
AppMetrica.reportExternalAttribution
method) in the AppMetrica SDK fromAttributionInfoCallback
.
Kotlin
Java
val tenjinSdk = TenjinSDK.getInstance(context, tenjinToken)
tenjinSdk.connect()
tenjinSdk.getAttributionInfo { attribution ->
// ...
AppMetrica.reportExternalAttribution(ExternalAttributions.tenjin(attribution))
// ...
}
TenjinSDK tenjinSDK = TenjinSDK.getInstance(context, tenjinToken);
tenjinSDK.connect();
tenjinSDK.getAttributionInfo(attribution ->
// ...
AppMetrica.reportExternalAttribution(ExternalAttributions.tenjin(attribution))
// ...
).
Airbridge
- Register
OnAttributionResultReceiveListener
. - Set up the sending of attribution data (the
AppMetrica.reportExternalAttribution
method) in the AppMetrica SDK fromOnAttributionResultReceiveListener
.
Kotlin
Java
val config = AirbridgeConfig.Builder(airbridgeAppName, airbridgeSdkAppToken)
.setOnAttributionResultReceiveListener { map ->
// ...
AppMetrica.reportExternalAttribution(ExternalAttributions.airbridge(map))
// ...
}
.build()
Airbridge.init(context, config)
AirbridgeConfig config = new AirbridgeConfig.Builder(airbridgeAppName, airbridgeSdkAppToken)
.setOnAttributionResultReceiveListener(map -> {
// ...
AppMetrica.reportExternalAttribution(ExternalAttributions.airbridge(map));
// ...
})
.build();
Airbridge.init(application, config);
Singular
- Register
SingularDeviceAttributionHandler
. - Set up the sending of attribution data (the
AppMetrica.reportExternalAttribution
method) in the AppMetrica SDK fromSingularDeviceAttributionHandler
.
Kotlin
Java
val config = SingularConfig(SINGULAR_SDK_KEY, SINGULAR_SDK_SECRET)
.withSingularDeviceAttribution { map ->
// ...
AppMetrica.reportExternalAttribution(ExternalAttributions.singular(map))
// ...
}
Singular.init(context, config)
SingularConfig singularConfig = new SingularConfig(SINGULAR_SDK_KEY, SINGULAR_SDK_SECRET)
.withSingularDeviceAttribution(map -> {
// ...
AppMetrica.reportExternalAttribution(ExternalAttributions.singular(map));
// ...
});
Singular.init(context, singularConfig);
If you didn't find the answer you were looking for, you can use the feedback form to submit your question. Please describe the problem in as much detail as possible. Attach a screenshot if possible.