Custom Audiences for Mobile Apps

Facebook offers the ability to define a Custom Audience for ad targeting. In order to reach your existing mobile app users, we offer app developers multiple ways to reach them.

You might find these useful if:

  • You want to reach people already using your app with Facebook ads on desktop or mobile
  • You want to reach people who have taken a specific action in your app (like a purchase) with a specific message
  • Your app doesn't use Facebook Login, but you want to reach your highly engaged users

Custom Audiences from your mobile app Using our SDK in your mobile app or a Mobile Measurement Partner, you can create Custom Audiences to reach people that have taken specific actions within your app with ads almost immediately after they do so, without uploading any files. To learn more about this type of Custom Audience Creation, please see our tutorial on Custom Audiences from your mobile app.

Custom Audiences from your data files You can also create Custom Audiences using data files. In addition to being able to reach your current customers using their email, phone numbers, and Facebook UIDs you already have in a privacy safe way, you can now leverage Mobile Advertiser IDs for Custom Audience targeting. To learn more about this type of Custom Audience Creation, please continue reading below.

There are three types of Mobile Advertiser IDs we support:

  • Apple's Advertising Identifier (IDFA) - An advertising ID that Apple provides as part of iOS in its ads framework.
  • Android's advertising ID - An advertsing ID that Google provides as part of Google Play services.
  • App User IDs - An ID corresponding to an app user that can be retrieved through the Facebook SDK. Details are covered later in this document.

Please Note: All three types must be uploaded under "Mobile Advertiser IDs" in Custom Audiences. No action is necessary if you have uploaded lists of App User IDs previously.

Easy Targeting for Mobile App Engagement Ads

You can easily reach people who have installed your app if you are planning to run mobile app engagement ads.

If your application is measuring installs or app events with the Facebook SDK or a Mobile Measurement Partner, you can reach existing app users by just checking a box. When setting up mobile app engagement ads, simply check the "target people who have installed your mobile app" option when selecting your targeting and you will then see an estimate of your ad's audience size. Learn more in our mobile app engagement ad tutorial.

Using Apple's Advertising Identifier (IDFA) or Android's advertising ID

You can reach your users by using Apple or Google's standard advertising identifiers, if your app is set up to collect them. To learn more, please see Apple's iOS Developer Library or Google Play services.

The ability to upload these IDs for targeting purposes is available in Ads Create, Power Editor under "Mobile Advertiser IDs" or via our Ads APIs.

Flow of Apple's Advertising Identifier (IDFA) or Android's advertising ID

Using Facebook App User Ids

When someone takes an action in your app and you want to reach them (such as someone expresses interest in buying something and you want to follow up, someone hasn't returned to a game for a while, etc.), you can use an app user ID to connect with the person via an ad.

The ability to upload App User IDs for targeting purposes is available in Power Editor under "Mobile Advertiser IDs" or via our Ads APIs.

Flow of App User IDs

Steps to using app user ID Targeting in Custom Audiences

  1. When someone uses your app, you can make a request to Facebook's servers to request an ID be generated.
  2. Facebook will return an encrypted ID for that person. (It can also return nothing depending on a person's choice - see below for more information.)
  3. You then send that ID to your server in order to use it later for custom targeting.
  4. You can upload this list of app user IDs to Power Editor or use our Ads API to upload this list and reach your custom audience with any type of Facebook ad. This will be designated Mobile Advertiser IDs in Power Editor or via our APIs.

A couple of things to note:

  1. Each call to Facebook's server to generate an app user ID will generate a different ID. Although multiple calls will end up targeting the same person, the app user IDs generated can't be used to correlate across apps or app instances. As such, the app user ID should not be used as a login token or considered to be a unique identifier.
  2. With Custom Audiences, no personal customer information (such as demographic, Facebook ID, etc.) is shared with you or advertisers, and your developer-specific data is not shared with Facebook.
  3. Facebook's iOS SDK API respects the iOS Ad Tracking privacy setting in iOS 6. This means that in some cases the call to generate an app user ID will return nothing based on a person's intent. It can also return nil if a person doesn't have the Facebook app installed or isn't logged in. So be sure to handle this case in your code.

Requesting an app user ID on iOS

Requesting an app user ID from Facebook requires making a method call and handling a callback. Make a request to Facebook's server to generate an ID. The sample code here uses an inline completion handler, which you can substitute with your own code. Remember that this call can return nil in some cases:

[FBRequestConnection startForCustomAudienceThirdPartyID:nil
    completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
      NSString *id = error ? nil : [result objectForKey:@"custom_audience_third_party_id"];
      // Stash off this id, send it to your server, etc.  Use later to construct
      // a Custom Audience.  A result of 'nil' means that either the user can't be
      // identified, or they've limited ad tracking via iOS 6.
    }
];

For more information please see the FBRequest, FBRequestConnection and FBSettings classes in the iOS Reference Documentation.


Requesting an App User ID on Android

Requesting an app user ID on Android requires that you create a new request, execute it and handle the results. You can find this on the Request object.

Request request = Request.newCustomAudienceThirdPartyIdRequest(
  null,  // Session
  this,  // Context
  new Request.Callback() {
    @Override
    public void onCompleted(Response response) {

      String app_user_id = null;
      GraphObject graphObject = response.getGraphObject();
      if (graphObject != null) {
        app_user_id = (String)graphObject.getProperty("custom_audience_third_party_id");
      }

      // Stash off this app_user_id, send it to your server, etc.  Use later to construct
      // a Custom Audience.  A result of 'null' means that the user can't be
      // identified
    }
  }
);

// Invoke the Request in whatever synchronous or asynchronous manner you choose.
request.executeAndWait();
Was this document helpful?