---
updatedAt: 2026-08-16T11:29:13.000Z
---

# Conversion data

In this guide you will learn how to get conversion data using [`AppsFlyerConversionListener`](https://dev.appsflyer.com/hc/docs/android-sdk-reference-appsflyerconversionlistener), as well as [examples](https://dev.appsflyer.com/hc/docs/conversion-data-android#accessing-attribution-data) for using the conversion data.

Learn more about [what is conversion data](https://dev.appsflyer.com/hc/docs/conversion-data).

## Before you begin

The following code examples require you import [`AppsFlyerLib`](https://dev.appsflyer.com/hc/docs/android-sdk-reference-appsflyerlib) and [`AppsFlyerConversionListener`](https://dev.appsflyer.com/hc/docs/android-sdk-reference-appsflyerconversionlistener):

```java Java
import com.appsflyer.AppsFlyerLib;
import com.appsflyer.AppsFlyerConversionListener;
```

## Setting-up AppsFlyerConversionListener in Android SDK

### AppsFlyerConversionListener overview

The [`AppsFlyerConversionListener`](https://dev.appsflyer.com/hc/docs/android-sdk-reference-appsflyerconversionlistener) interface lets you listen to conversions.

If you implement and register [`AppsFlyerConversionListener`](https://dev.appsflyer.com/hc/docs/android-sdk-reference-appsflyerconversionlistener) when calling [`init`](https://dev.appsflyer.com/hc/docs/android-sdk-reference-appsflyerlib#init), its [`onConversionDataSuccess`](https://dev.appsflyer.com/hc/docs/android-sdk-reference-appsflyerconversionlistener#onconversiondatasuccess) callback is invoked whenever:

* A user opens the app
* A user moves the app to the foreground

If for whatever reason the SDK fails to fetch the conversion data, [`onConversionDataFail`](https://dev.appsflyer.com/hc/docs/android-sdk-reference-appsflyerconversionlistener#onconversiondatafail) is invoked.

## Accessing attribution data

When invoked, [`onConversionDataSuccess`](https://dev.appsflyer.com/hc/docs/android-sdk-reference-appsflyerconversionlistener#onconversiondatasuccess) returns a `Map` (called `conversionDataMap` in the example) that contains the conversion data for that install. The conversion data is cached the first time [`onConversionDataSuccess`](https://dev.appsflyer.com/hc/docs/android-sdk-reference-appsflyerconversionlistener#onconversiondatasuccess) is called and will be identical on consecutive calls.

### Organic vs. Non-organic conversions

A conversion can be either **Organic** or **Non-organic**:

* An Organic conversion is an unattributed conversion that is usually the result of a direct install from an app store.
* A Non-organic conversion is a conversion that is attributed to a [media source](https://support.appsflyer.com/hc/en-us/articles/212188826-Types-of-media-sources).

You can get the conversion type by checking the value of `af_status` in [`onConversionDataSuccess`](https://dev.appsflyer.com/hc/docs/android-sdk-reference-appsflyerconversionlistener#onconversiondatasuccess)'s payload. It can be one of the following values:

* `Organic`
* `Non-organic`

#### Example

```java
import com.appsflyer.AppsFlyerConversionListener;
import com.appsflyer.AppsFlyerLib;
import com.appsflyer.AppsFlyerLibCore.LOG_TAG;

AppsFlyerConversionListener conversionListener =  new AppsFlyerConversionListener() {
    @Override
    public void onConversionDataSuccess(Map<String, Object> conversionDataMap) {
        for (String attrName : conversionDataMap.keySet())
            Log.d(LOG_TAG, "Conversion attribute: " + attrName + " = " + conversionDataMap.get(attrName));
        String status = Objects.requireNonNull(conversionDataMap.get("af_status")).toString();
        if(status.equals("Organic")){
            // Business logic for Organic conversion goes here.
        }
        else {
            // Business logic for Non-organic conversion goes here.
        }
    }

    @Override
    public void onConversionDataFail(String errorMessage) {
      Log.d(LOG_TAG, "error getting conversion data: " + errorMessage);
    }

    @Override
    public void onAppOpenAttribution(Map<String, String> attributionData) {
      // Must be overriden to satisfy the AppsFlyerConversionListener interface.
      // Business logic goes here when UDL is not implemented.
    }

    @Override
    public void onAttributionFailure(String errorMessage) {
      // Must be overriden to satisfy the AppsFlyerConversionListener interface.
      // Business logic goes here when UDL is not implemented.
      Log.d(LOG_TAG, "error onAttributionFailure : " + errorMessage);
    }

};
```
```kotlin
import com.appsflyer.AppsFlyerConversionListener
import com.appsflyer.AppsFlyerLib
import com.appsflyer.AppsFlyerLibCore.LOG_TAG
  
class AFApplication : Application() {
    // ...
    override fun onCreate() {
        super.onCreate()
        val conversionDataListener  = object : AppsFlyerConversionListener{
            override fun onConversionDataSuccess(data: MutableMap<String, Any>?) {
                // ...
            }
            override fun onConversionDataFail(error: String?) {
                Log.e(LOG_TAG, "error onAttributionFailure :  $error")
            }
            override fun onAppOpenAttribution(data: MutableMap<String, String>?) {
                // Must be overriden to satisfy the AppsFlyerConversionListener interface.
                // Business logic goes here when UDL is not implemented.
                data?.map {
                    Log.d(LOG_TAG, "onAppOpen_attribute: ${it.key} = ${it.value}")
                }
            }
            override fun onAttributionFailure(error: String?) {
                // Must be overriden to satisfy the AppsFlyerConversionListener interface.
                // Business logic goes here when UDL is not implemented.
                Log.e(LOG_TAG, "error onAttributionFailure :  $error")
            }
        }
        AppsFlyerLib.getInstance().init(devKey, conversionDataListener, applicationContext)
        AppsFlyerLib.getInstance().start(this)
    }

}
```

[Github link](https://github.com/AppsFlyerSDK/appsflyer-onelink-android-sample-apps/blob/80763ef8c93c49b1f0226455ae35d089f7968ede/java/basic_app/app/src/main/java/com/appsflyer/onelink/appsflyeronelinkbasicapp/AppsflyerBasicApp.java#L99-L143)

## Deferred deep linking (Legacy method)

When the app is opened via deferred deep linking, [`onConversionDataSuccess`](https://dev.appsflyer.com/hc/docs/android-sdk-reference-appsflyerconversionlistener#onconversiondatasuccess)'s payload returns deep linking data, as well as attribution data.

* The recommended best practice is to implement deep linking with [Unified Deep Linking (UDL)](https://dev.appsflyer.com/hc/docs/unified-deep-linking-udl)
* For existing clients and reference, here is our [legacy Android deep linking guide](https://dev.appsflyer.com/hc/docs/dl_android_gcd_legacy#deferred-deep-linking), using [`AppsFlyerConversionListener`](https://dev.appsflyer.com/hc/docs/android-sdk-reference-appsflyerconversionlistener).