Facebook Ads setup guide

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

If you already have AppsFlyer's SDK integrated in your app, and already have defined your app on 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 below.

Facebook App ID

But first, if you still haven't defined your app in Facebook, follow these instructions to create the Facebook app ID:

  1. Visit Facebook's App Dashboard
  2. Click Create New App under Apps
  3. Complete the name for your app, and also a unique namespace

The same Facebook app ID can be used for both your Android and iOS apps.

Basic Facebook attribution setup

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


  1. When you define your mobile app on Facebook you get its Facebook App ID.
    Copy your Facebook App ID and head to your app's dashboard on AppsFlyer.


  2. Click on Integrated Partners link on the left bar.


  3. Search for Facebook and click on its logo to open the Facebook setup page.

  4. On the Integration tab activate the partner, then click inside the Facebook App ID box and paste.


  5. Activate Limit Facebook use of users’ personal information (CCPA) if you want to prevent receiving data for California users.

    You can deactivate this setting after you make the changes necessary for CCPA compliance.

  6. Configuring install attribution:
    1. Set the Install click-through lookback window.
      Select the lookback window units (hours or days) and set the slider to the desired value. The default lookback window is 28 days, to align with Facebook's default.
    2. To enable view-through attribution, activate Install view-through lookback window.
      Select the lookback window units (hours or days) and set the slider to the desired value.
      We recommend setting the view-through lookback window to 1 day, to match with Facebook.


  7. To reattribute users, who reinstall the app during their re-attribution window:
    1. Enable reinstall attribution.
      You don't need to enable view-through attribution or configure lookback windows for reinstall attribution, as it takes its configuration from the install attribution settings (see step 6).


    2. In the app settings page, Enable retargeting attribution.
  8. Configuring Re-engagement attribution:
    See here.
  9. Press Save & Close.

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

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


Ensure that the app collects either IDFA or GAID. Failing to do so results in Facebook installs being attributed as organic. For further information refer to the SDK Integrations Guides for either iOS or Android.

Advanced Facebook attribution setup

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



User-level data

By default Facebook does not release raw user-level data.
On the Integration tab (or here) click to accept Facebook's Terms of Service. This allows AppsFlyer to collect and enable you access to your Facebook users' raw data.


Effective April 22, 2020, Facebook introduced enhanced data privacy measures to protect people using their services. As such, Facebook no longer provide advertisers with view-through attribution data at the device level. Starting from the effective date, view-through conversions and the associated in-app events display under the restricted media source. The associated attribution fields in user-level sources such as raw data reports, Push API messages, Pull API reports, are not populated. 

In-app events mapping

Limitations regarding event names:

  • Length limitation of event names: 2-40 characters 
  • The following characters are not allowed:
    • Colon (:)
    • Period (.)
    • Non-Latin (English) character sets: As of January 12, 2020, Facebook rejects Chinese characters. AppsFlyer has not tested other character sets and you should use these only after verifying with Facebook if they support these character sets in postbacks. 
  • Event names are case-sensitive. To avoid discrepancies, make sure you use
    the correct case in the event names for all media sources and app versions.
  1. Toggle In-App Event Postbacks to ON


    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 predefined 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 predefined 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 lets advertisers attribute an existing user's engagement with a Facebook ad, and measure the quality of the user, post engagement, using the AppsFlyer reports.

It should be used ONLY if you are actively running campaigns targeted at your own users in Facebook.

  1. Enable re-targeting in app settings page.
  2. Turn on Re-engagement attribution in Facebook configuration in AppsFlyer.
  3. Set the Re-engagement click-through lookback window.
    The re-engagement lookback window is the period of time, starting from ad click, during which the app must be launched for the click to be recorded as a re-engagement.
    Select a lookback window in hours or days and set the slider to the desired value.
  4. Set the Re-engagement window.
    This is the period when the user's in-app events are attributed to the retargeting media source, as primary source.
    You can set the value in days (1-90), hours (up to 23), or even lifetime. The default is 30 days.


  • For more information about AppsFlyer's retargeting attribution, click here.
  • For information about deep linking users from SRNs, such as Facebook's, click here.

Cost, clicks and impressions data


Enabling the Facebook Cost feature gets you the cost data for your Facebook campaigns, adsets, ads and channel levels. It also gets you the 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.
    Note: In the first data sync after integration, AppsFlyer receives Facebook's cost data up to 30 days retroactively. In subsequent syncs, AppsFlyer receives data from the last 7 days. 

Read more about how Facebook defines clicks and views.

To delete a connected Facebook account:

  • In the actions column, hover over an account, click Delete connection.


  • 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 lists that 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 login with Facebook credentials for the correct app.

Partner API is not responding

  • The ad network cost data API is either down or experiencing issues.
  • Advertiser enabled 2FA in Facebook after the account was integrated in AppsFlyer.
  • Wait for the network API to become responsive.
  • If the issue is due to 2FA:
    1. Log out of your Facebook account.
    2. In AppsFlyer, go to the Cost tab of the Facebook integration, and delete the connection.
    3. In the Cost tab, click login and follow the steps there.

Invalid Credentials

AppsFlyer is unable to pull cost data as the connection is no longer valid. This can happen if your Facebook password changes or if the AppsFlyer permission is 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. Enter the Audience Network App ID. Get this from Facebook Audience Network (FAN).
    • Go to the FAN monetization manager dashboard.
    • Find the property, then select the Ad Space.
    • Below the Placements table, find the Placement ID column on the right.
    • Copy the ID to the Audience Network App ID field in AppsFlyer
  6. Click Save ad revenue.
Was this article helpful?