Importing attributions on Unity

To set up integration, call the attribution retrieval method on the client, then call the attribution sending method AppMetrica.ReportExternalAttribution.

AppsFlyer

  1. Register IAppsFlyerConversionData when initializing AppsFlyer.
  2. Set up the sending of attribution data (the AppMetrica.ReportExternalAttribution method) in the AppMetrica SDK from IAppsFlyerConversionData.
public class AppsFlyerConversionDataListener : IAppsFlyerConversionData {
    public void onConversionDataSuccess(string conversionData) {
        AppMetrica.ReportExternalAttribution(ExternalAttributions.AppsFlyer(conversionData));
    }

    // ...
}

AppsFlyer.initSDK("devkey", "appId", new AppsFlyerConversionDataListener());

Adjust

  1. Register Action<AdjustAttribution> using the AdjustConfig.setAttributionChangedDelegate method.
  2. Set up the sending of attribution data (the AppMetrica.ReportExternalAttribution method) in the AppMetrica SDK from Action<AdjustAttribution>.
var adjustConfig = new AdjustConfig("token", AdjustEnvironment.Production);
adjustConfig.setAttributionChangedDelegate(attribution => {
    AppMetrica.ReportExternalAttribution(ExternalAttributions.Adjust(attribution));
});
Adjust.start(adjustConfig);

Kochava

  1. Register Action<KochavaTrackerInstallAttribution> using the KochavaTracker.GetInstallAttribution method.
  2. Set up the sending of attribution data (the AppMetrica.ReportExternalAttribution method) in the AppMetrica SDK from Action<KochavaTrackerInstallAttribution>.
KochavaTracker.Instance.GetInstallAttribution(currentInstallAttribution => {
    AppMetrica.ReportExternalAttribution(ExternalAttributions.Kochava(currentInstallAttribution.Raw.ToString()));
});

Tenjin

  1. Register Tenjin.AttributionInfoDelegate using the BaseTenjin.GetAttributionInfo method.
  2. Set up the sending of attribution data (the AppMetrica.ReportExternalAttribution method) in the AppMetrica SDK from Tenjin.AttributionInfoDelegate.
var tenjinSdk = Tenjin.getInstance("apiKey");
tenjinSdk.Connect();

tenjinSdk.GetAttributionInfo(attributionInfoData => {
    AppMetrica.ReportExternalAttribution(ExternalAttributions.Tenjin(attributionInfoData));
});

Airbridge

  1. Register the OnAttributionResultReceived callback using the AirbridgeUnity.SetOnAttributionReceived method.
  2. Set up the sending of attribution data (the AppMetrica.ReportExternalAttribution method) in the AppMetrica SDK from OnAttributionResultReceived.
public class AirbridgeAttribution : MonoBehaviour {
    public void Init() {
        AirbridgeUnity.SetOnAttributionReceived(name);
    }

    public void OnAttributionResultReceived(string jsonString) {
        AppMetrica.ReportExternalAttribution(ExternalAttributions.Airbridge(jsonString));
    }
}

Singular

  1. Register SingularDeviceAttributionCallbackHandler.
  2. Set up the sending of attribution data (the AppMetrica.ReportExternalAttribution method) in the AppMetrica SDK from OnSingularDeviceAttributionCallback.
public class SingularDeviceAttributionHandler : SingularDeviceAttributionCallbackHandler {
    public void OnSingularDeviceAttributionCallback(Dictionary<string, object> attributionInfo) {
        AppMetrica.ReportExternalAttribution(ExternalAttributions.Singular(attributionInfo));
    }
}

SingularSDK.SetSingularDeviceAttributionCallbackHandler(new SingularDeviceAttributionHandler());

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.

Contact support