A deep link is a link that goes not only to your app, but to a specific piece of content within your app. For more information, see Add Deep Links to Your App Ad.
You can support deep linking by using Universal Links or by using Custom URL Schemes.
Before you can support Universal Links in your iOS mobile app, you must satisfy the following prerequisites:
Follow the Apple guidelines to allow apps and websites to link to your content, including:
Update your website to support associated domains
Update your app to support universal links
After you meet the prerequisites, you can add code to your app to support Aggregated Event Measurment. For more information, see Aggregated Event Measurement.
In the App Dashboard add deep linking information for your app. Navigate to Dashboard > Settings > iOS.
://
. For example, if your URL scheme is mytravelapp://
, enter mytravelapp
. Note: This does not apply as a requirement for iOS versions below iOS16.APP_STORE_ID
.Deferred deep linking allows you to send people to a custom view after they install your app through the app store.
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.
Due to iOS 14 updates, Deferred Deep Linking is no longer supported for the POST /{ad-id}
endpoint for SKAdNetwork Campaigns.
The Facebook SDK for iOS includes the product App Links, which enables 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.
If you follow the GDPR compliance in GDPR Compliance in FB SDK Best Practices for GDPR Compliance, re-enable automatic SDK initialization first after an end user provides consent before fetching a deferred link.
Code to handle deferred links:
#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; }
Code to re-enable automatic SDK initialization, if necessary:
#import <FBSDKCoreKit/FBSDKCoreKit.h> - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { if (launchOptions[UIApplicationLaunchOptionsURLKey] == nil) { // Get user consent [FBSDKSettings setAutoInitEnabled:YES]; [FBSDKApplicationDelegate initializeSDK: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; }
Code to handle deferred links:
import FacebookCore func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { AppLinkUtility.fetchDeferredAppLink { (url, error) in if let error = error { print("Received error while fetching deferred app link %@", error) } if let url = url { if #available(iOS 10, *) { UIApplication.shared.open(url, options: [:], completionHandler: nil) } else { UIApplication.shared.openURL(url) } } } return true; }
Code to re-enable automatic SDK initialization, if necessary:
import FacebookCore func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { // Get user consent Settings.isAutoInitEnabled = true ApplicationDelegate.initializeSDK(nil) AppLinkUtility.fetchDeferredAppLink { (url, error) in if let error = error { print("Received error while fetching deferred app link %@", error) } if let url = url { if #available(iOS 10, *) { UIApplication.shared.open(url, options: [:], completionHandler: nil) } else { UIApplication.shared.openURL(url) } } } return true; }
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 SetupIf you have select App Installs as your objective you can add a Deferred Deep Link.
In the Ads Manager, select New AdSet and scroll to Ad Creative. Add your deep link or a URL with Facebook App Links metadata implemented to take users to a specific location in the app after installing.