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).



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. iOS verifies the Universal Link ownership using the Apple App Site Association file hosted by AppsFlyer in the location:
  5. AppsFlyer SDK is initialized and the install is attributed in the AppsFlyer servers.
  6. 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.
  7. 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.


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:

data: [AnyHashable: Any]

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.
    • 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

// Handle Organic/Non-organic installation
func onConversionDataSuccess(_ data: [AnyHashable: Any]) {

    print("onConversionDataSuccess data:")
    for (key, value) in data {
        print(key, ":", value)

    if let status = data["af_status"] as? String {
        if (status == "Non-organic") {
            if let sourceID = data["media_source"],
                let campaign = data["campaign"] {
                print("This is a Non-Organic install. Media source: \(sourceID)  Campaign: \(campaign)")
        } else {
            print("This is an organic install.")
        if let is_first_launch = data["is_first_launch"] as? Bool,
            is_first_launch {
            print("First Launch")
            if let fruit_name = data["deep_link_value"]
                // The key 'deep_link_value' exists only in OneLink originated installs
                print("deferred deep-linking to \(fruit_name)")
                walkToSceneWithParams(params: data)
            else {
                print("Install from a non-owned media")
        } else {
            print("Not First Launch")

⇲ Github links: Swift

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:

func onConversionDataFail(_ error: Error) {

⇲ Github links: Swift

Did this page help you?