Adding Deep Links to Your App Ad

A deep link is a link that goes not only to your app, but to a specific piece of content within your app. With deep linking, you send people directly to information they are interested in when they open your app for the first time.

By using deep linking in your app ads, you are removing extra steps between clicking the ad and getting to the content that made someone want to open your app. This provides a more seamless customer experience. Without deep links, people will have to search through your app for the content they are looking for, and you risk them losing interest.

Guides

How a Deep Link Works

Step-By-Step Guide

How a Deep Link Works

  1. Your ad shows personalized content. For example, an offer for a vacation to San Francisco.
  2. People click to download your app.
  3. Because the download link is a deep link, the app opens at the point of inspiration: the vacation to San Francisco.

Because the first landing point in your app is related to the attractive idea that motivated a person to tap the ad, they are more likely to engage with the content of your app.

On iOS, deep linking works only with ads. As a result, you can't use deep linking with other things, like app invites.

Step-by-Step Guide

1. iOS & Android Setup

2. Facebook SDK

3. Facebook App Settings

4. Deferred Deep Linking

5. Verify Deep Link Setup

6. Add Deep Link to Your Ad


1. iOS & Android Setup

iOS

You can most easily handle deep links using the Bolts Framework. You can learn more about the Framework on Github: https://github.com/BoltsFramework/Bolts-iOS.

If you do not want to use the Bolts Framework, follow one of these tutorials (or something similar):

Android

Read the official tutorial Create Deep Links to App Content on android.com.

2. Facebook SDK

Follow our step-by-step guide SDK Setup. It shows how to:

  1. Get a Facebook App ID
  2. Add the Facebook SDK to your app
  3. Enable Install Tracking
SDK Setup

3. Facebook App Settings

Once you complete the Facebook SDK Setup, add deep linking information in your Facebook app settings.

iOS Settings

  • URL Scheme Suffix: Add your URL scheme without ://. For example, if your URL scheme is mytravelapp://, enter mytravelapp.
  • App Store ID: You can get your App Store ID from your App Store URL: https://itunes.apple.com/us/app/my-app/APP_STORE_ID.

Android Settings

  • ClassName: Find the ClassName of the launch activity in the file AndroidManifest.xml. The class name should take the form com.example.androidapp.MainActivity.
iOS - Navigate to Dashboard > Settings > iOS
Android - Navigate to Dashboard > Settings > Android

4. Deferred Deep Linking (optional)

Deferred deep linking allows you to send people to a custom view after they install your app through the app store.

When do You Need Deferred Deep Linking?

You must use deferred deep linking if you target people who did not install your app yet. If you are only targeting people who already installed your app, you do not need to add deferred deep linking.

Deferred Deep Linking with App Links

The Facebook SDK for iOS and Android includes the product App Links, which will enable you to support deferred deep linking in your app. In addition to your deep link implementation, just add the following code to your app to handle deferred deep links:

// Add Bolts.framework to your project (part of the FB SDK)
#import <Bolts/Bolts.h> 
#import <FBSDKCoreKit/FBSDKCoreKit.h>

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  if (launchOptions[UIApplicationLaunchOptionsURLKey] == nil) {
    [FBSDKAppLinkUtility fetchDeferredAppLink:^(NSURL *url, NSError *error) {
      if (error) {
        NSLog(@"Received error while fetching deferred app link %@", error);
      }
      if (url) {
        [[UIApplication sharedApplication] openURL:url];
      }
    }];
  }
  return YES;
}
AppLinkData.fetchDeferredAppLinkData(this, 
  new AppLinkData.CompletionHandler() {
     @Override
     public void onDeferredAppLinkDataFetched(AppLinkData appLinkData) {
         // Process app link data
     }
 }
);

Class Reference: iOS > FBSDKAppLinkUtility | Android > AppLinkData

5. Verify Deep Link Setup

You can verify your Facebook SDK and deep link setup within our App Ads Helper in the tools & support section. We recommend verifying your setup before you start running deep link ads.

Verify Deep Link Setup

Follow our App Ads Guide.

When creating your ad, pay attention to the following settings:

  1. Target Platform: In "Who do you want your ads to reach?" use:
    • iOS: iOS only for the setting platform.
    • Android: Android only for the setting platform.
  2. Add Deep Link: In "What text and links do you want to use?", add your deep link; for example, mytravelapp://tripId=SF.

Screenshot: Add Deep Link to Your Ad