OneLink Integration Guide Version 1.1

Introduction

AppsFlyer OneLink is a single, smart, tracking link that can be used to track both Android and iOS. OneLink tracking links can launch your app when it is already installed (Deeplinking) instead of redirecting the user to the app store.

Get attribution data flow:

To use OneLink, you must do the following:

  1. Enable deeplinking in your app.
  2. Integrate AppsFlyer SDK for Deeplinking.
  3. Create an AppsFlyer link.
  4. (Optional) Access AppsFlyer attribution data and use it.

1. Enable Deeplinking in Your App

To configure an app to handle Deeplinking, you must register a URL scheme for your app.

iOS Deeplink Settings

Settings vary according to the iOS version being used.

iOS 9 and Above

For iOS 9 Deeplinking you must set up Universal Links on your apps.  For details of how to perform this, see here.

iOS 8 and Below

To register a URL scheme you must define it in your app’s information plist file.

  1. In Xcode, open your app information plist file.
  2. Add a URL types entry
  3. Expand URL type and “item 0” rows and add a new row.
  4. Add a unique identifier for your app for URL identifier as a value. It is best to select a unique identifier which is unlikely to be used by other apps.

Right-click the URL identifier and select Add Row, then select URL Schemes and set the Item 0 value to your unique scheme.

OneLink_Integration_2.png

To make sure this works, run the app on your device or the iPhone simulator, open Safari and enter a URL that starts with your unique scheme. Example: twitter://something. It should leave Safari and open your app.

See Implementing Custom URL schemes in Apple’s Programming Guide for more details.

Android Deeplink Settings

To register a URL scheme you must add an intent filter in your app manifest.

In your app’s manifest add the following intent-filter to your relevant activity (no need to add for the default activity):

<intent-filter>
               <action   android:name="android.intent.action.VIEW" />
               <category android:name="android.intent.category.DEFAULT" />
               <category android:name="android.intent.category.BROWSABLE" />
               <data     android:scheme="your unique scheme" />
</intent-filter>

Example:

<activity android:label="@string/app_name" …..  >
           <intent-filter >
               <action android:name="android.intent.action.MAIN" />
               <category android:name="android.intent.category.LAUNCHER" />
           </intent-filter>
           <intent-filter>
               <action   android:name="android.intent.action.VIEW" />
               <category android:name="android.intent.category.DEFAULT" />
               <category android:name="android.intent.category.BROWSABLE" />
               <data     android:scheme="my-scheme" />
           </intent-filter>
   </activity>

To make sure this works, run the app on your device, open the default browser and enter a URL which starts with your unique scheme. Example: my-scheme://something, opens your app.

2. Integrating AppsFlyer SDK for Deeplinking

iOS Integration

This is in addition to the standard integration which can be found here.

Once your app is integrated with the AppsFlyer SDK you only need to call the SDK’s handleOpenURL from the app delegate openURL method. 

-(BOOL) application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity
restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler {

   
   [[AppsFlyerTracker sharedTracker] continueUserActivity:userActivity restorationHandler:restorationHandler];
   return YES;
}

This code is relevant for users of iOS 8 and below.

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)
sourceApplication annotation:(id)annotation {
      
[[AppsFlyerTracker sharedTracker] handleOpenURL:url sourceApplication:sourceApplication];
       return true;
}

Android Integration

On Android, the basic integration of AppsFlyer’s SDK handles deeplinking launches and no additional action is required. See AppsFlyer Android integration guide for integrating an app with AppsFlyer.

3. Create an AppsFlyer Link

Deeplinking is enabled by adding the af_dp parameter to the URL. The value for this parameter is your app deeplink URL.

Example:

http://app.appsflyer.com/id554782625?pid=test&c=test&af_dp=ebay://products/cameras/EOS311

4. Access AppsFlyer’s Attribution Data

AppsFlyer enables apps to access deep linking attribution data (in addition to the installation attribution data. See Accessing AppsFlyer Attribution for more information)

On iOS

You can implement AppsFlyerTrackerDelegate’s onAppOpenAttribution method to retrieve the attribution of the current session.

Example:

- (void) onAppOpenAttribution:(NSDictionary*) installData {
   NSLog(@"attribution: %@",installData);
}

On Android

You can implement AppsFlyerConversionListener’s onAppOpenAttribution method to retrieve the attribution of the current session.

Example:

AppsFlyerLib.registerConversionListener(this,new AppsFlyerConversionListener() {
           public void onInstallConversionDataLoaded(Map<String, String> conversionData) {
               // do something
           }
 
           public void onAppOpenAttribution(Map<String, String> conversionData) {
               // handle the attribution here
           }
});
 

For example, the following link generates this result:

Link:

http://app.appsflyer.com/Facebook?pid=test&c=camp1&af_sub1=param1&af_dp=fb://somePath


Result data:

{
   "af_sub1" : "param1",
   "campaign" = "camp1",
   "media_source" = "test"
}

5. Opening Links on Other Platforms

It is possible to configure a fallback URL to be used when the link is clicked on a platform other than Android or iOS. For example if you want to run an email campaign and use your website when the mail is opened on a desktop browser.

This is performed by adding the af_web_dp parameter on the link to the website’s URL.

Example:

http://go.onelink.ly/MyApp?af_web_dp=http%3A%2F%2Fmy-site.com/my-deep-link-path

 

6. OneLink & Social Apps

Advertisers may want to use OneLink with "viral" posts on social apps, as potential users that are exposed to those posts can't be targeted in advance according to their devices.

Unfortunately, limitations set mainly by Apple's Universal Links in conjunction with restrictions of some of the social apps, prevent the usage of OneLink for deeplinking, or even sometimes for basic device recognition, redirection and attribution. 

The following table sums up what you can do with OneLink in today’s popular social apps:

Social App Android Redirection Android Deeplinking iOS Redirection iOS Deeplinking
Facebook Y N Y N
Twitter Y Y Y N
Wechat N N N N
Instagram Y N Y N
Slack Y Y Y Y
Whatsapp Y Y Y Y
Line Y Y Y N

The Workaround for Social Apps

To avoid the mentioned OneLink limitations, and still enable device redirection and deeplinking on social apps' posts, we recommend using landing pages.

The user's flow is as follows:

1. User clicks on the ad on the social app

2. User is redirected to a landing page

3. User clicks on a big "Download app" button on the landing page, which contains OneLink behind it.

4. Regular OneLink flow follows including deeplinking and attribution using fingerprinting.

 Note

The conversion rates may be a bit lower due to to the required second click.

Was this article helpful?
1 out of 2 found this helpful