RevenueCat

Build With RevenueCat

Build a customized mobile subscription business with RevenueCat. We do the heavy lifting of normalizing subscribers from any source and maintain a single source of truth for subscription status, so you can get back to building your app.

RevenueCat is a powerful, secure, reliable, and free to use in-app purchase server with global support. All you need to get started is an API key.

Facebook Ads

Integrate the Purchases SDK with Facebook Ads Manager

With our Facebook Ads integration you can:

  • Accurately track subscriptions generated from Facebook Ad campaigns, allowing you to know precisely how much revenue your campaigns generate.
  • Send trial starts, trial conversions, and renewals directly from RevenueCat to Facebook Ads Manager, allowing for accurate tracking without an app open.
  • Continue to follow your cohorts for months to know the long tail revenue generated by your campaigns.

1. Install Facebook SDK

Before RevenueCat can integrate with Facebook, your app must be running the Facebook SDK. Refer to the Facebook developer documentation for the latest installation instructions.

2. Send attribution data to RevenueCat

Use the addAttributionData method to pass attribution information from Facebook to RevenueCat. With Facebook, you just need to pass an empty dictionary into this method, since everything is collected automatically by the Purchases SDK.

import AdSupport

...

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    
    Purchases.configure(withAPIKey: "public_sdk_key", appUserID: "my_app_user_id")
    
    Purchases.addAttributionData([:], from: .facebook)
}
#import <AdSupport/AdSupport.h>
  
...

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  // Override point for customization after application launch.
  
  [RCPurchases configureWithAPIKey:@"public_sdk_key" appUserID:@"my_app_user_id"];
  
  [RCPurchases addAttributionData:@{} fromNetwork:RCAttributionNetworkFacebook];
  	
  return YES;
}
Purchases.addAttributionData({}, Purchases.ATTRIBUTION_NETWORKS.FACEBOOK);

Import AdSupport Framework (iOS only)

On iOS, (and cross-platform SDKs) you must import the AdSupport framework to properly capture attribution data.

To enable the AdSupport framework:

  1. In your Xcode project, select your project's target.
  2. Select the General tab for your target.
  3. Expand the Linked Frameworks and Libraries section.
  4. Click + to add a framework.
  5. Select AdSupport.framework.

Before submitting your app for review, ensure your app complies with IDFA usage guidelines.

Remove Facebook SDK Purchase Tracking

Make sure to remove all client side tracking of revenue. Since RevenueCat will be sending events for all revenue actions, tracking purchases with the Facebook SDK directly can lead to double counting of revenue in Facebook Ads Manager.

You can disable automatic In-App Purchase event logging from the Facebook SDK or from your Facebook app dashboard. Go to the iOS card under Settings > Platform > Log In-App Events Automatically > No

To continue to track install and usage events in Facebook, call the Facebook SDK activateApp method after configuration.

3. Send RevenueCat events into Facebook Ads Manager

After you've set up the Purchase SDK to send attribution data to RevenueCat, you can "turn on" the integration from the RevenueCat dashboard.

  1. Navigate to your app in the RevenueCat dashboard and choose 'Facebook' from the integrations menu.
  2. Add your Facebook App ID for production events (and optionally an App ID for sandbox events).
  3. Add the Facebook Client Token for your app (and for the sandbox App ID if included). You can find your Client Token in the Facebook dashboard under your App > Settings > Advanced > Client Token. You may need to click the 'Reset' button if there's no Client Token visible.
  4. Select whether you want RevenueCat to report proceeds (after app store cut) or revenue (gross sales).
Facebook Ads configuration screen

Facebook Ads configuration screen

Event Names

RevenueCat uses the following 'Standard' Facebook event names. Using 'Standard' events is recommended by Facebook for optimizing advertising campaigns and audiences.

RevenueCat Event
Facebook Event

Trial Started

StartTrial

Trial Converted

Subscribe

Initial Purchase

Subscribe

Renewal

Subscribe

Non-Renewing Purchase

Purchase

4. View Events in Facebook

Once events are delivered to Facebook, they can be used across Analytics, Ads Manager, and Audiences.

Facebook event delay

Note that there could be up to a 24 hour delay from when events are sent to when they are shown in the Facebook Analytics dashboard.

Analytics

The events sent from RevenueCat will appear throughout Facebook Analytics as 'Standard' event types. Any events sent with revenue attached will be counted toward the 'Revenue' number in Facebook. This includes trial conversions and renewals that occur when the app isn't active.

Revenue is sent directly into Facebook Analytics

Revenue is sent directly into Facebook Analytics

Ads Manager

Within Facebook Ads Manager, you can customize the display columns to include subscription specific metrics. The 'Subscriptions' and 'Trials Started' values will be updated by the 'Subscribe' and 'StartTrial' events sent by RevenueCat, respectively.

By tracking the subscription revenue attributed to your Facebook campaigns you can quickly spot your most effective campaigns.

Audiences

Facebook allows you to create custom audiences based off of events. This means you can create an audience of subscribers, and even create a "Lookalike" audience for better ad targeting.

To create a custom audience off of subscribers:

  1. Create a Custom Audience and select 'App activity' as the source.
  1. Choose an event, such as 'Subscribe' to create your audience off of.

You've done it!

You should start seeing events from RevenueCat appear in Facebook Ads Manager.

Facebook Ads


Integrate the Purchases SDK with Facebook Ads Manager

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.