Accessing AppsFlyer Attribution / Conversion Data from the SDK - Android (Deferred Deeplinking)

AppsFlyer allows you to access the user attribution data in real-time directly at the SDK level. It enables you to customize the landing page that a user sees on the very first app open after a fresh app install. This is commonly referred to as “deferred” deeplinking. This is very common on the web, however there is a big challenge doing this in the mobile app ecosystem. Luckily, AppsFlyer provides support for all cases and platforms.

Sending a new app user to a deeplink on install is very similar to using app deeplinking custom URL Scheme (iOS Android ) for users that have already installed your app. 

For example:

Consider a user who has just clicked on a HotelTonight’s Google Adwords ad for a "Hotels New York" search.  The user is first sent to Google Play/App-Store to download the app and upon first app open the user lands directly on the Hotels in New York page. By accessing the attribution data provided by AppsFlyer, the application will receive the exact campaign and keywords used to drive that user/install.

Besides the enhanced experience and improved conversion, this functionally enables sophisticated context based campaigns such as providing the user with a credit/bonus for installing and using the app. For example: Instead of "Click to install" campaigns to "Install and get $50 credit". These campaigns not only improve the click to install conversion, but also improve the conversion to paying users. These campaigns can improve overall ROI by 2X-5X! 

Capture.JPG

 

AppsFlyer's NativeTrack™ SDK is performing server side tracking. That means that the conversion track is processed and available on AppsFlyer’s servers. Accessing the attribution data from AppsFlyer's SDK might take few seconds from the first app open.

Another option to get the AF tracking referring URL is by adding an additional listener to the INSTALL_REFERRER broadcast. Please see here for more details. Note that it does not work for server-side tracking (ID matching, Fingerprinting, Facebook and out of Google Play APKs.)

NOTES:  

  • According to Facebook's privacy policy, AppsFlyer (or any other 3rd party mobile measurement partner) cannot provide user level attribution for Facebook installs unless you accept Facebook's Terms of Service. More info here. If you choose not to accept the Terms of Service, Facebook Mobile Ads installs are categorized as ‘Organic’ and you are unable to receive the user level data for Facebook installs. 
  • Accessing the attribution data to implement deferred deeplinking is applicable for the user's first launch after the install.  To implement deeplinking for users who already have the app installed, see here.

SDK Implementation:

Supported by AF Android SDK 2.3.1.9. and above.

onInstallConversionDataLoaded

OnInstallConversionDataLoaded has the attribution data of the install. You can use this function to:

  1. Deferred Deeplinking - customize your app’s landing page to user that had entered the app for the first time.
  2. Get install attribution data for different events during the user's lifetime within your app

For example:

A user downloads and launches your app for the first time after seeing your ad for red shoes on Facebook. To send the user directly to the red shoes page in your app, use OnInstallConversionDataLoaded

 

To access AppsFlyer's conversion data from the Android SDK implement the ConversionDataListener: 

public interface AppsFlyerConversionListener {
        void onInstallConversionDataLoaded(Map<String,String> conversionData);         void onInstallConversionFailure(String errorMessage);
}

Example:

AppsFlyerLib.getInstance().registerConversionListener(this, new AppsFlyerConversionListener() {
   @Override
public void onInstallConversionDataLoaded(Map<String, String> conversionData) {
       for (String attrName : conversionData.keySet()) {
           Log.d(AppsFlyerLib.LOG_TAG, "attribute: " + attrName + " = " +
conversionData.get(attrName));
       }
   }
   @Override
   public void onInstallConversionFailure(String errorMessage) {
       Log.d(AppsFlyerLib.LOG_TAG, "error getting conversion data: " +
errorMessage);
   }
});

Available Keys in Attribution Response:

The returned conversion data consists on ALL the parameters on the original tracking link and some additional server parameters created on the time of click or install.

Since the conversion data is reliant on the tracking link, it means that different sources and tracking links may produce different conversion data parameters.

The onConversionDataReceived function is called every time the app is launched.
There are 3 possible outcomes depending on the type of the install:

1. Non organic install - returns the original attribution data of the install (see the examples below).

2. Organic install (or re-install) - returns "organic install"

3. Re-attribution - returns the re-attribution conversion details.

Key Name

Explanation

Example Values

Media Sources

af_status

Shows what type of attribution was detected.

Valid values:

  • Organic
  • Non-Organic
  • Error

Non-Organic

All

af_message

Free text

Organic install/Error message

All

media_source

Media source name. This is the AF tracking link ‘pid’ parameter

  • inmobi_int
  • tapjoy_int
  • Facebook Ads

NOTE: Agency derived install sources are hidden and have "null" value.

All

 

campaign

Campaign name (AppsFlyer’s tracking link ‘c’ parameter or Facebook campaign name)

Ad1/camp123

All

clickid

Click id or transaction id

123456/xsfd234

All

af_siteid

Site id (for optimization)

Site1

All

af_sub1

Extra parameter

someParameter

All

af_sub2

Extra parameter

 

All

af_sub3

Extra parameter

 

All

af_sub4

Extra parameter

 

All

af_sub5

Extra parameter

 

All

af_keywords

Keywords searched for in search campaigns.  E.g. Google Search Campaigns

 

All

click_time

Click date & time (milliseconds)

2014-01-08 00:07:53.233

All

install_time

Conversion date & time (milliseconds)

2014-01-08 00:12:51.701

All

agency

Agency or PMD generating the install

nanigans

All

af_channel

The channel through which the ads are distributed

Instagram, YouTube

All

is_fb

 

Flag indicating it’s a Facebook attribution. Values: true/false

true

Facebook

adgroup

Facebook’s ad name

Angry Bird Facebook ad 1

Facebook

adgroup_id

Facebook’s ad ID

6012740800279

Facebook

campaign_id

Facebook’s campaign ID

6012700005123

Facebook

adset

Facebook’s ad set name

US - 18+

Facebook

adset_id

Facebook ad set ID

6099800005123

Facebook

ad_id

Facebook’s unique identification number of an ad

6012998843079

Facebook

 

Examples:

Facebook Attribution Response 

NOTE: There is no tracking link for Facebook campaigns.

{
"adset":"T:DAT-Desktop_O:All_L:AR-AE_A:All_R:1-30 Day",
   "adgroup":"T:DAT-Desktop_O:All_L:AR-AE_A:All_R:1-30 Day",
   "campaign_id":"6068535534218",
   "af_status":"Non-organic",
   "agency":null,
   "af_sub3":null,
   "af_siteid":null,
   "adset_id":"6073532011618",
   "is_fb":true,
   "click_time":"2017-07-18 12:55:05",
   "iscache":false,
   "ad_id":"6074245540018",
   "af_sub1":null,
   "campaign":"T:DAT_L:AR-AE",
   "is_paid":true,
   "af_sub4":null,
   "adgroup_id":"6073532011418",
   "is_mobile_data_terms_signed":true,
   "af_channel":"Facebook",
   "af_sub5":null,
   "media_source":"Facebook Ads",
   "install_time":"2017-07-19 08:06:56.189",
   "af_sub2":null
}

Regular AppsFlyer Tracking Link Response Example (Not Facebook):

Install generated using the following AF tracking link:

http://app.appsflyer.com/angry-birds-android?pid=tapjoy_int&c=July4-2014&af_prt=starcomm&af_siteid=57&af_sub1=subtext1&freehand-param=somevalue

Attribution response:

{
   "media_source":"Yeahmobi_int",
   "campaign":"Yeahmobi_TH",
"adset"
:null,
   "clickid":"fb7f51d42-2621-93bd-e9a1b24f1acfab7b76e5104706104f4d683ffdb560c0010",
   "adgroup":null,
   "campaign_id":null,
   "af_cost_currency":"USD",
   "af_status":"Non-organic",
   "af_sub_siteid":"1702",
   "agency":"ECHOMARKETING",
   "af_sub3":null,
   "af_cost_model":"CPI",
   "af_siteid":"1777215",
   "af_dp":"agoda://home",
   "adset_id":null,
   "click_time":"2017-07-19 08:30:31.890",
   "cost_cents_USD":"150",
   "iscache":true,
   "af_cpi":null,
   "af_sub1":"102619",
   "af_cost_value":"1.5",
   "af_click_lookback":"1d",
   "af_sub4":null,
   "site_id":"1777215",
   "adgroup_id":null,
   "tag":"8d55089f-31b6-407b-9266-00690845fbce",
   "orig_cost":"1.5",
   "af_prt":"ECHOMARKETING",
   "af_sub5":null,
   "install_time":"2017-07-19 08:30:35.461",
   "af_sub2":"Yeahmobi_TH_G001_Android"
}

 NOTE: Key order may vary. Additional keys might be added without notice.

Was this article helpful?
3 out of 5 found this helpful
Have more questions? Submit a request
Powered by Zendesk