Push Campaigns Quickstart

This guide helps you set up Push Campaigns in 5 quick steps.

Before You Start

Make sure you have a Facebook Developer account—if you don't have one already, create one now.

You'll also need to add the Facebook SDK to your app. The following guides take you through all the necessary steps:

iOS SDK SetupAndroid SDK Setup

When you're done, return here to set up Facebook Analytics. This allows you to start sending push campaigns to the people using your app.

In-App Notifications

Prior to sending in-app notifications you will also need to integrate the FBNotifications library.

1. Log App Events and Register Device Tokens

App events are the key actions people take as they use your app. They include actions like launching your app, viewing content, making a purchase, and many more.

When you integrated the Facebook SDK with your app, you probably added the code to log your first app event: activateApp. If not, you can use the code below:

// Add to your AppDelegate.m file
- (void)applicationDidBecomeActive:(UIApplication *)application {    
    // Call the 'activateApp' method to log an app event for use
    // in analytics and advertising reporting.
    [FBSDKAppEvents activateApp];
// Add to each long-lived activity
protected void onResume() { 
// for Android, you should also log app deactivation
protected void onPause() { 

You can log an app event for any meaningful action people take in your app. There are many pre-defined events such as completed registration, viewed content, searched, added to cart, spent credits, and more. We support up to 1,000 unique events.

You can also define your own custom events. Try this now by adding this code to a button click handler in your app:

// Add to a button click handler
- (void)buttonClick:(id)sender {    
    // logs your custom event, feel free to use 
    // a string of your choosing here
    [FBSDKAppEvents logEvent:@"sentFriendRequest"];
AppEventsLogger logger = AppEventsLogger.newLogger(this);
// Add to a button click handler  

Now launch your app and click the button you added the above code to—this logs your first custom event.

Finally, in order for Push Campaigns to work you'll also need to upload the device token:

2. Verify Your App Events

You can see the most recent app events logged by your app. To verify your events, open Facebook Analytics. Choose your app and navigate to Activity > Event Debugging.

You should see your app launch and custom event in the feed. If not, click the refresh button to load the latest events.

Once you've verified your app events are being delivered, you're ready to create your first segment. Segments help you target your push campaigns to the right people.

3. Create a Segment

A segment is a group of people you define based on their activity in your app, such as adding an item to a cart, but not purchasing it. Segments help you target your push campaigns so only the right people see them.

Campaigns can't be targeted to segments based on demographic, install source, or exclusion events. Segments targeting by device must have at least one event rule.

To create a segment in Facebook Analytics:

  1. Go to Activity > Active Users.
  2. Click the dropdown menu at the top and select Manage Segments.
  3. Click Create New at the top-right corner.
  4. Enter a segment name.
  5. Below Define Conditions, click Add Condition to add any conditions necessary to define the group of people you want to include in your segment. Learn more about adding conditions to your segment.
  6. Once you're finished, click Save at the top right.

Keep in mind that after creating a new segment, it may take several hours to generate data.

4. Add Your Push Credentials


To send push notifications to your iOS app, you'll need to generate a push notification client SSL certificate. This allows Facebook Analytics to connect to the Apple Push Notification service (APNs) to send your campaigns to the people using your app.

You can generate a certificate at the Apple Developer Member Center and then upload your certificate to the Settings page in Facebook Analytics. The upload should include both the certificate and your private key in a form of a single .p12 file.

For a step-by-step guide to get these credentials, see Apple's developer docs.

Make sure your certificate is not associated with a password, otherwise the system will not be able to accept it.


To send push notifications to your Android app, provide your Firebase Cloud Messaging (FCM) API key attached to your FCM sender ID in the Settings page in Facebook Analytics.

For a step-by-step guide to obtain these credentials for Android, see Google's developer docs.


Once you've generated your iOS SSL certificate and/or received your Android FCM API key, you'll need to enter it in the Settings page in Facebook Analytics. You can do this by going to Facebook Analytics and then clicking the small gear icon near the lower left corner of the page.

  1. Go to Settings in Facebook Analytics by clicking at the bottom left of any screen
  2. Go to the Push Campaign Credentials section
  3. Upload your Apple Push Notification service certificate by clicking Upload File
  4. Enter your Firebase Cloud Messaging service API key and click Save to save the API key

5. Verify Your Push Credentials

  1. Go to Settings in Facebook Analytics by clicking at the bottom left of any screen
  2. Go to the Push Campaign Setup Verification section
  3. Enter your device token of the device you would like to test. For more information on how to get the device token see the documentation for iOS and Android.
  4. Select the device type you plan to send your test notification
  5. If you selected an iOS device, you should select the matching bundle ID
  6. Click Send Push Notification to send a test push notification to that device
  7. Click Send In-App Notification to send a test in-app notification to that device (you must have integrated the FBNotifications library for this to work)

Learn More