SDK Setup and Adding App Events

When you first complete app setup, you can only optimize delivery of your ads for LINK_CLICK or clicks on the actual ad. For best results, we recommend that you add more events so you can also optimize your ad for installs or other actions such as purchases or D2 or D7 retention (opening the app again two or seven days after installing).

If you're working with a Facebook Mobile Measurement Partner, your partner can set up your app, SDKs and App Events for you.

If you will be doing the setup and adding app events yourself, you can use this page to find out how. The basic steps are:

  • Set up a Facebook SDK (described below). For mobile apps, set up the iOS SDK or Android SDK (or both). For desktop games, set up the JavaScript SDK.
  • Add app events. Use Codeless App Events or add app event code manually.

SDK Setup

Facebook SDKs enable you to pass app event data from your app to Facebook. With app event data, you can accurately track and measure the actions people take in your app.

Once you've implemented the SDK for your platform, you should also add code for additional app events you want to track and measure.

  1. If you have not already done so, under Settings > Basic in the App Dashboard add a Platform for your app.

    If you provide your app on multiple platforms, you should repeat this setup for each platform where your app is available. For example, if your app is available on both Android and iOS, you should set up platforms twice in your app settings - once for the Android SDK and a second time for the iOS SDK.

  2. Download the SDK and follow the instructions for each SDK.
  3. Add or import the SDK in your app, using your developer environment.
  4. Configure the SDK in your app.
  5. Add your initial app event. By default, the SDKs already provide app install events.
  6. Test the SDK setup by triggering a test app event.

At this point, the SDK is set up, and your application can pass app install events to Facebook for measurement and tracking purposes. With this data, you can track and measure app installs and also optimize your ads delivery for mobile app installs. After you aggregate enough app install events, you can optimize ads delivery for installs and follow-up events such as purchases or value optimization.

In the next section, we will look at how to track more types of events.

For full instructions and documentation on Facebook SDKs, see the iOS, Android, and JavaScript SDK guides.

Adding Other App Events

After you verify your SDK is set up correctly, you can add additional app events to your app. This enables you to track or log your app events automatically or when you make specific calls in your app.

For a complete list of the standard app events you can log, see:

You can track and measure these app events in two ways:

  • Use our codeless setup tool in Facebook's Events Manager. This is a simple tool for setting up events without implementing code. You can interact with app screen elements such as buttons, images, or links to define event names. As your users navigate through the app and interact with these UI elements, events will be sent to Facebook.

For more information, regardless of platform, see App Events API. In a few cases, you may want to set up custom App Events, which track special events that are unique to your application. For full details, see Facebook Analytics, App Events.

At this point, you can track and measure for any of the app events you implemented. With App Events, you can use `APP_INSTALLS`, `TRAFFIC`, and `CONVERSIONS` as your advertising objectives. You can optimize your ads for people most likely to complete an app event; see App Event Optimization.

With this App Event data, you or your measurement partner could also create custom audiences, and you can target ads to these audiences. See Marketing API, Mobile App Custom Audiences and Ads Help Center, Custom Audience from your Mobile App.

Resubmit Your App

After you add a Facebook SDK and App Events to your app, you must resubmit your app to the app stores where it's available for download. You need to do this because you changed the source code. The app must also pass App Review.