The OneLink Developer Hub

Welcome to the OneLink developer hub. You'll find comprehensive guides and documentation to help you start working with OneLink as quickly as possible, as well as support if you get stuck. Let's jump right in!

Deferred deep linking

This page discusses deferred deep linking

At a glance: Deferred deep linking setup enables the marketer to create links that will send new app users first to the correct app store to install the app, and then, after the first open, to a specific app experience (e.g. a specific page in the app).

Overview

Deferred deep linking directs new users first to the correct app store to install the app, and then, after the first open, to a specific app experience (e.g. a specific page in the app).

When the user first launches the app, the onConversionDataSuccess callback function receives both the conversion data of the new user, and OneLink data. The OneLink data makes in-app routing possible due to the deep_link_value that is passed to the app when the OS opens the app.

Only the deep_link_value is required for deep linking. However, other parameters and values (such as custom attribution parameters) can also be added to the link and returned by the SDK as deep linking data. The AppsFlyer OneLink ensures that the correct parameters are passed along with the user's click, thus personalizing the user’s app experience.

The marketer and developer must coordinate regarding desired app behavior and deep_link_value. The marketer uses the parameters to create deep links, and the developer customizes the behavior of the app based on the value received.

It is the developer's responsibility to make sure the parameters are handled correctly in the app, for both in-app routing, and personalizing data in the link.

The deep linking flow works as follows:

  1. User clicks the OneLink on a device on which the app is not installed.
  2. AppsFlyer registers the click and redirects the user to the correct app store or landing page.
  3. The user installs the application and launches it.
  4. AppsFlyer SDK is initialized and the install is attributed in the AppsFlyer servers.
  5. The SDK triggers the onConversionDataSuccess method. The function receives input that includes both the deep_link_value, and the attribution data/parameters defined in the OneLink data.
  6. The parameter is_first_launch has the value true, which signals the deferred deep link flow.
    The developer uses the data received in the onConversionDataSuccess function to create a personalized experience for the user for the application’s first launch.

Procedures

To implement the onConversionDataSuccess method and set up the parameter behaviors, the following action checklist of procedures need to be completed.

Procedure checklist

  1. Deciding app behavior on first launch, and deep_link_value (and other parameter names and values) - with the marketer
  1. Planning method input, i.e. deep_link_value (and other parameter names and values) - with the marketer
  1. Implementing the onConversionDataSuccess() logic
  1. Implementing the onConversionDataFail() logic

Deciding app behavior on first launch

To decide app behavior on first launch:

Get from the marketer: The expected behavior of the link when it is clicked and the app opens for the first time.

Planning method input

For deferred deep linking, the onConversionDataSuccess method input must be planned and the input decided in the previous section (for deep linking) is made relevant for the first time the app is launched.

The onConversionDataSuccess method gets the deep_link_value and other variables as an input like this: Map <String, Object>.

The map holds two kinds of data:

  • Attribution data
  • Data defined by the marketer in the link (deep_link_value and other parameters and values)
    Other parameters can be either:
    • AppsFlyer official parameters.
    • Custom parameters and values chosen by the marketer and developer.
    • The input data structure is described here.

The marketer and developers need to plan the deep_link_value (and other possible parameters and values) together based on the desired app behavior when the link is clicked.

To plan the deep_link_value, and other parameter names and values based on the expected link behavior:

  1. Tell the marketer what parameters and values are needed in order to implement the desired app behavior.
  2. Decide on naming conventions for the deep_link_value and other parameters and values.
    Note:
    • Custom parameters will not appear in raw data collected in AppsFlyer.
    • Conversion data will not return a custom parameter named "name, " with a lowercase "n".

Implementing onConversionDataSuccess() logic

When the app is opened for the first time, the onConversionDataSuccess method is triggered in the main activity. The deep_link_value and other parameters in the method input are used to implement the specific user experience when the app is first launched.

To implement the logic:

  1. Implement the logic based on the chosen parameters and values. See the following code example.
  2. Once completed, send confirmation to the marketer that the app behaves accordingly.

📘

Sample code

@Override
 public void onConversionDataSuccess(Map<String, Object> conversionData) {
     for (String attrName : conversionData.keySet())
         Log.d(LOG_TAG, "Conversion attribute: " + attrName + " = " + conversionData.get(attrName));
     String status = Objects.requireNonNull(conversionData.get("af_status")).toString();
     if(status.equals("Non-organic")){
         if( Objects.requireNonNull(conversionData.get("is_first_launch")).toString().equals("true")){
             Log.d(LOG_TAG,"Conversion: First Launch");
             if (conversionData.containsKey("deep_link_value")){
                 Log.d(LOG_TAG,"Conversion: This is deferred deep linking.");
                 //  TODO SDK in future versions - match the input types
                 Map<String,String> newMap = new HashMap<>();
                 for (Map.Entry<String, Object> entry : conversionData.entrySet()) {
                         newMap.put(entry.getKey(), String.valueOf(entry.getValue()));
                 }
                 onAppOpenAttribution(newMap);
             }
         } else {
             Log.d(LOG_TAG,"Conversion: Not First Launch");
         }
     } else {
         Log.d(LOG_TAG,"Conversion: This is an organic install.");
     }
 }

⇲ Github links: Java

Implementing onConversionDataFailure() logic

The onConversionDataFailure method is called whenever the call to onConversionDataSuccess fails. The function should report the error and create an expected experience for the user.

To implement the onConversionDataFailure method:

Enter the following code:

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

⇲ Github links: Java

Updated about a month ago


Deferred deep linking


This page discusses deferred deep linking

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.