Facebook Ads Setup Guide

  • Advertisers
  • Agencies


How long does it take to start attributing your Facebook mobile app ads with AppsFlyer?

If you have integrated AppsFlyer's SDK in your app and have defined your app in Facebook, the answer is less than a minute!

You don't need to implement Facebook Login or integrate your app with Facebook's SDK for mobile attribution. Just follow the step-by-step setup instructions that follow.

Facebook App ID

If you haven't defined your app on Facebook, create a Facebook App ID as follows:

  1. Go to Facebook for developers, App Dashboard.
  2. Click My AppsCreate New App.
  3. Fill out the fields
  4. Click Create App ID.
    The Facebook App ID displays.

Basic Facebook Attribution Setup

To start attributing Facebook campaigns with AppsFlyer, follow these steps:


Step 1:

Before you begin to configure AppsFlyer you need the Facebook App ID. You can get the Facebook App ID as follows.

  1. Go to Facebook for developers.
    The Facebook app dashboard window opens.
  2. Copy the App ID.

Step 2:

Configure your app details, in AppsFlyer, in the Facebook integrated partners page.

  1. In AppsFlyer select the app.
    The app dashboard window opens.
  2. In the navigation bar, click Integrated Partners.

  3. Search for Facebook, click the Facebook logo.
    The configuration window opens.
  4. On the Integration tab, switch on the Activate Partner. Facebook integration
  5. In the Facebook App ID field, paste the App ID.
  6. Switch Enable Retargeting on.

  7. Set the duration of the Re-Engagement Window. That is the period when the user's in-app events are attributed to the retargeting media source. Select one of the following:

    • Days: 1-90
    • Hours: 1-23
    • Lifetime
  8. The Click-Through Attribution Lookback Window has a default value of 28 days to match with Facebook. To change this select one of the following:
    • Days: 1-30
    • Hours: 1-23
  9. The View-Through Attribution Lookback Window has a default value of 1 day,  to match with Facebook. To change this select one of the following:
  10. Click Save Integration.

Congratulations! You have completed basic attribution for Facebook mobile campaigns with AppsFlyer!

(Still not seeing Facebook results on AppsFlyer? Click here)


Your app must collect IDFA/GAID advertiser identities otherwise all of your Facebook installs will be attributed as organic. See the SDK Integrations Guides for iOS and Android.

Advanced Facebook Attribution Setup

With basic attribution set up for Facebook, it's time for some quick advanced attribution setup.



User-level data

Facebook does not release raw user-level data to without your agreement. To agree to the release of the data, you need to review and agree to Facebook's terms of service.

To review and accept Facebook's terms of service:

  1. Go to the Integration tab.fb_terms_of_service.png
  2. Click Terms of Service or here to open Facebook's terms of service.
    The Facebook terms of service window opens.
  3. Review the terms of service, and if agreeable click Accept.
    Appsflyer can now collect and enable you to access, your Facebook user raw data.

In-App Events Mapping

  1. Switch on In-App Event Postbacks.


    When enabling the Facebook in-app events mapping for an app for the first time, all the af_XXX events from the SDK are automatically mapped to Facebook's pre-defined event list. This automatic mapping saves you time and decreases mapping mistakes significantly.

  2. The Sending Option for all SDK defined events is Events attributed to any partner or organic, i.e., your entire user base is available to be reported to Facebook.
  3. Click Add Event to add an SDK Event to the list
  4. Fill in the following parameters:
Parameter Name Description
SDK Event Name The name of the event, as received by AppsFlyer either from the SDK integrated in your app, or from server to server events.
Tip - don't see the event you want in the list? Make sure to activate the event on a device with a non-organic installation and recheck.
Partner Event Identifier Select the most suitable pre-defined Facebook event tag for your event. You can also send Facebook CUSTOM events.
Send Revenue When unchecked - AppsFlyer sends all the parameters of the rich in-app event to the partner, except for the revenue parameter, which is contained in the af_revenue parameter.
When checked - AppsFlyer sends all the parameters including the revenue value (if exists in the event).

For more information about mapping in-app events with Facebook go here.

Retargeting Attribution


AppsFlyer's retargeting attribution for Facebook enables advertisers to attribute an additional engagement of a user with an ad on Facebook, and measure the quality of the user, post engagement, using the AppsFlyer reports.

  1. Ensure Retargeting is enabled for the app on the App Settings page. For details, click here.
  2. Set the Facebook Ads Retargeting toggle to ON.
  3. Set the time period following the re-engagement, where the user's in-app events are attributed to the retargeting media source. You can set the value in days (1-90), hours (up to 23), or even lifetime.
  4. For more information about AppsFlyer's retargeting attribution, click here.
  5. For information about deep linking users from SRNs, such as Facebook's, click here.

Cost, Clicks and Impressions Data


Enabling the Facebook Cost feature not only gets you the cost data for your Facebook campaigns, adsets, ads and channel levels. It also gets you the full aggregated clicks and impressions data for them.

  1. Make sure you are logged into the Facebook user account, which is enabled to handle the account's campaigns on Facebook. The user signing-in must have permissions to run all the campaigns in Facebook Business Manager
  2. Go to the Cost tab
  3. Toggle ON the Get Cost, Clicks and Impressions Data button
  4. Click the Facebook Login button
  5. When prompted, allow AppsFlyer to access your Facebook campaign data


  • If you are already logged into Facebook, when you click the Facebook Login button, the Facebook window immediately opens and closes. This is the regular behavior.
  • If you have several users with permissions to Facebook, the best practice is to perform the Facebook login for all of them, to avoid getting partial data.

Cost Data Sync Status

The cost tab shows the status of your cost integration and the last time AppsFlyer managed to pull matching cost data.

Facebook allows you to sync several accounts for pulling cost data. For each synced account, AppsFlyer shows the status of cost integration and the last time AppsFlyer managed to pull matching cost data.


The table below describes five different status messages, and what to do if you see them in the cost tab.

Status Message Description What to Do


Partner API is responding and returning data.




With sync message:

Cost Data was never successfully pulled

One of the following is possible:

  1. You just set up the integration and AppsFlyer have yet to pull data.
  2. There is no data in AppsFlyer about installs coming from the ad network.
  1. Wait for AppsFlyer to pull data.
  2. Start running campaigns with the ad network.


No Matching Data


AppsFlyer queries this app's active campaigns with the Partner API, but the partner API isn't returning any data for these campaigns.

This might happen if you change the campaign ID while it is still running.

If you rely on cost data, do not change the IDs of campaigns while they are still active and running.

Also, make sure you entered the API credentials for the correct app, and that the network is passing the correct campaign IDs on the attribution link.

Partner API is not responding

The ad network cost data API is either down or experiencing issues.

Wait for the network API to become responsive.

Invalid Credentials

AppsFlyer in unable to pull cost data as the connection is no longer valid. This can happen if your Facebook password was changed or if AppsFlyer's permission was revoked.

Re-login to Facebook in the Cost tab.

Last Successful Data Pull

The cost tab shows the last time cost data has been pulled yet. If cost data has never been pulled, the sync message shows Cost Data was never successfully pulled.




Scenario 1 - Stopped Campaigns

AppsFlyer pulls cost for several campaigns that you run with ad network A. You look in the cost tab and you see the message Last successful sync 2 hours ago. The same day you stop running campaigns with ad network A. Two weeks later, you look in the cost tab of ad network A. You then see the message Last successful sync 14 days ago.


Scenario 2 - Ad Network API Issues

AppsFlyer pulls cost for several campaigns that you run with ad network B. You look in the cost tab and you see the message Last successful sync 2 hours ago. Ad network B then experiences issues with their API. It takes them a few hours to fix it. When you look in the cost tab you see the message Last successful sync 8 hours ago.

For more information about enriching your Facebook information with cost, clicks and impressions data, click here.

Ad Revenue Recording


If your app uses Facebook Audience Network Ad Revenue for ad monetization, you can record your revenues from Facebook on AppsFlyer. This, with or without in-app purchase revenue data, gives you a complete picture of your user revenues.

To start recording Facebook Audience Network Ad Revenue:

  1. On the Ad Revenue tab set Get Ad Revenue Data to ON
  2. Set the Event Source, which is the event representing your ad revenue model in the best possible way. For example, if your revenue is based on impressions, it is recommended to send AppsFlyer an ad viewed event. The best event can be configured for each monetization platform separately. However, it is also possible to use the af_app_opened event. In this case, ad revenue is attributed for every app open performed by the user.
  3. The Ad Revenue Event is displayed. It is a read-only field presenting the new ad revenue event called [source event]_monetized (e.g. Ad_Watched_Monetized as displayed above). The ad revenue event is presented in the dashboard as an additional event.
  4. Click Facebook Ad Revenue to enable collection of Facebook Audience Network Ad Revenue on Facebook. Login with your Facebook credentials to authorize Facebook Audience Network Ad Revenue.
  5. Click Save & Close.
Was this article helpful?
6 out of 8 found this helpful

Page Contents: