Facebook SDK for App Ads

Create AdVerify Your App Ads Setup

Add the Facebook SDK for iOS, Android or JavaScript to your app to:

  • Measure installs
  • Measure app events
  • Add deep linking to your ads
  • Bring people back to your app
  • Improve targeting
  • Encourage purchases
  • Create re-engagement ads
  • Measure in-app conversions

To learn more about these topics read our guides for measuring, targeting and customizing ad formats.

For information about using the Windows SDK for Facebook developed by Microsoft, see Windows SDK for Facebook.

Step-by-Step: Facebook SDK Setup

1. Facebook App ID

You need a Facebook App ID to use the Facebook SDK for iOS, Android or JavaScript (Web). You can use an existing app if you already have one. Otherwise use our Quick Start to create a new app. If you need help follow our how-to Register and Configure an App.

Quick Start: Add a New App

To measure installs in the Facebook Ads Manager you have to associate advertising accounts with your app using the app dashboard.

  1. Go to the app dashboard
  2. Choose your app.
  3. Navigate to "Settings > Advanced" and add accounts via the Authorized Ad Account IDs input field.
App Dashboard

3. Add the Facebook SDK to your app

Follow the instructions of our "Getting started" guides to add the Facebook SDK to your app:

iOSAndroidJavaScript

For iOS / Android: You do not need to add any functionality like Sharing or Login with Facebook.

4. Enable Install Tracking

To enable install tracking call the App Events logger once your application becomes active.

- (void)applicationDidBecomeActive:(UIApplication *)application {
   [FBSDKAppEvents activateApp];
}
// In your Application class
@Override
public void onCreate() {
    super.onCreate();
    FacebookSdk.sdkInitialize(getApplicationContext());
    AppEventsLogger.activateApp(this);
}

Desktop Canvas Apps: By integrating Facebook Login to your Facebook Canvas, App Launches and App Installs are logged automatically. Other Web Apps: We do not support install tracking for web apps not hosted on facebook.com.

For information about install tracking using Microsoft's Windows SDK for Facebook, see the App Events section.

5. More Tracking Methods

If you want to track other app events like a person making a purchase, visit our App Events guide.

Example: Log Purchase

[FBSDKAppEvents logPurchase:4.32 currency:@"USD"];
var params = {}; // optional parameters like `CONTENT_ID`
FB.AppEvents.logPurchase(4.32, "USD", params);
logger.logPurchase(BigDecimal.valueOf(4.32), Currency.getInstance("USD"));

Example: Custom Event

[FBSDKAppEvents logEvent:@"myCustomEventName"];
FB.AppEvents.logEvent("myCustomEventName");
logger.logEvent("myCustomEventName");

App Events Guide

Verify Setup (for iOS/Android)

Once you completed the step-by-step guide and use your app tracking will start. You can verify that app events and the Facebook SDK are working properly via the App Ads Helper:

Verify Setup

Keep in Mind

  • App ID: The app ID used in your app must match the app ID used in your ad.
  • Advertising Accounts: If you want other people or companies to run ads on behalf of your app, you can associate advertising accounts with your app via the App Dashboard: From the settings tab, choose Advanced > Advertising Accounts.