Facebook

This guide describes how to add and configure Facebook Analytics and Ads Manager integration.

Configure this integration and analyze your app metrics right on Facebook Analytics. Send events to Facebook Ads Manager to build lookalike audiences based on subscription events (like renewals) and maximize your ROI.

How to Add Integration?

Please make sure that you disabled Facebook Automatic Purchase Events Logging in app settings. See step 7 for details.

Step 1
2
3
4
5
6
7
8
9
✅ 10
Step 1
  • Create new Facebook app, if you don't have it.

  • Integrate or update Facebook SDK to the latest version.

  • Pass attribution data from Facebook to Apphud.

2

Open your Facebook app settings and copy your App ID:

3

At Apphud go to "Integrations" section and add Facebook:

4

Paste App ID into "Facebook app ID" field:

5
  • Return to Facebook app settings, open "Advanced Settings" and copy Client Token.

  • Paste Client Token into "Client Token" field in Apphud:

6

If you don't want to mix test and live data, create separate test app on Facebook. Paste test App ID and Client Token into corresponding fields.

7

For both (live and test) apps disable Automatic Purchase Events Logging. This is required to prevent revenue double counting in Facebook Analytics and Ads Manager. The switch can be found in app "Basic" settings:

8

For some events, you can enter custom names. For others, you can choose between Facebook build-in events. You can also specify event aliases that will be sent as event properties under alias key. Please, use only letters (a..z), numbers (0..9), underscore (_) for event names and aliases. You can also disable sending some events using switches.

9

Enable integration:

✅ 10

Save changes:

Pass attribution data to Apphud (required):

In case of Facebook attribution, you should pass empty data:

Swift
Objective-C
Kotlin
Swift
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Initialize ApphudSDK
Apphud.start(apiKey: "APPHUD_API_KEY")
// Initialize Facebook
ApplicationDelegate.shared.application(application, didFinishLaunchingWithOptions: launchOptions)
// Pass empty attribution data from Facebook to Apphud
Apphud.addAttribution(data: [:], from: .facebook, callback: nil)
}
func applicationDidBecomeActive(_ application: UIApplication) {
// manually track install in Facebook SDK
AppEvents.activateApp()
}
Objective-C
// Initialize Apphud
// ...
// Initialize Facebook
// ...
[Apphud addAttributionWithData:@{} from:ApphudAttributionProviderFacebook identifer:nil callback:^(BOOL result) {}];
// ...
- (void)applicationDidBecomeActive:(UIApplication *)application {
[FBSDKAppEvents activateApp];
}
Kotlin
// Initialize Apphud
// ...
// Initialize Facebook
// ...
Apphud.addAttribution(ApphudAttributionProvider.facebook)
// track installs manually
AppEventsLogger.activateApp(this)

While configuring integration you can also choose between sending revenue as sales or proceeds (without Apple / Google 15%-30% commission).

You can read more how Apple calculates commission here.

Events Cheat Sheet

This is a list of all possible events and their parameters that are being sent to AppsFlyer.

You can read more about subscription events here and parameters here.

Trial
Cancellations
Introductory Offer
Regular
Promo Offer
Other Events
Trial

Trial period started

Default event name: StartTrial

Parameters:

  • alias: String

  • fb_content_id: String

  • _valueToSum: Float

  • fb_currency: String

  • fb_num_items = 1

  • offer_type = "trial"

Successful conversion from trial period to regular subscription

Default event name: Subscribe

Parameters:

  • alias: String

  • fb_content_id: String

  • _valueToSum: Float

  • fb_currency: String

  • fb_num_items = 1

  • offer_type = "trial"

Failed conversion from trial period to regular subscription

Default event name: apphud_trial_expired

Parameters:

  • alias = "apphud_trial_expired"

  • fb_content_id: String

  • reason: String

Cancellations

Trial Canceled

Default event name: apphud_trial_canceled

Parameters:

  • alias = "apphud_trial_canceled"

  • fb_content_id: String

Subscription Canceled

Default event name: apphud_subscription_canceled

Parameters:

  • alias = "apphud_subscription_canceled"

  • fb_content_id: String

Autorenew disabled (Deprecated)

Default event name: apphud_autorenew_disabled

Parameters:

  • alias = "apphud_autorenew_disabled"

  • fb_content_id: String

Autorenew enabled

Default event name: apphud_autorenew_enabled

Parameters:

  • alias= "apphud_autorenew_enabled"

  • fb_content_id: String

Introductory Offer

Introductory offer started

Default event name: Subscribe

Parameters:

  • alias: String

  • fb_content_id: String

  • _valueToSum: Float

  • fb_currency: String

  • fb_num_items = 1

  • offer_type: String

Introductory offer renewed

Default event name: Subscribe

Parameters:

  • alias: String

  • fb_content_id: String

  • _valueToSum: Float

  • fb_currency: String

  • fb_num_items = 1

  • offer_type: String

Successful conversion from introductory offer to regular subscription

Default event name: Subscribe

Parameters:

  • alias: String

  • fb_content_id: String

  • _valueToSum: Float

  • fb_currency: String

  • fb_num_items = 1

  • offer_type: String

Failed conversion from introductory offer to regular subscription or failed renew

Default event name: apphud_intro_expired

Parameters:

  • alias = "apphud_intro_expired"

  • fb_content_id: String

  • reason: Float

  • offer_type: String

Refund during introductory offer

Default event name: Subscribe

Parameters:

  • alias: String

  • fb_content_id: String

  • _valueToSum: Float

  • fb_currency: String

  • fb_num_items = 1

  • reason: String

  • offer_type: String

Regular

Subscription started

Default event name: Subscribe

Parameters:

  • alias: String

  • fb_content_id: String

  • _valueToSum: Float

  • fb_currency: String

  • fb_num_items = 1

Subscription renewed

Default event name: Subscribe

Parameters:

  • alias: String

  • fb_content_id: String

  • _valueToSum: Float

  • fb_currency: String

  • fb_num_items = 1

Subscription expired

Default event name: apphud_subscription_expired

Parameters:

  • alias= "apphud_subscription_expired"

  • fb_content_id: String

  • reason: Float

Subscription refunded

Default event name: Subscribe

Parameters:

  • alias: String

  • fb_content_id: String

  • _valueToSum: Float

  • fb_currency: String

  • fb_num_items = 1

  • reason: String

Promo Offer

Promotional offer started

Default event name: StartTrial or Subscribe depending on promo offer type.

Parameters:

  • alias: String

  • fb_content_id: String

  • _valueToSum: Float

  • fb_currency: String

  • fb_num_items = 1

  • offer_id: String

  • offer_type: String

Promotional offer renewed

Default event name: StartTrial or Subscribe depending on promo offer type.

Parameters:

  • alias: String

  • fb_content_id: String

  • _valueToSum: Float

  • fb_currency: String

  • fb_num_items = 1

  • offer_id: String

  • offer_type: String

Successful conversion from promotional offer to regular subscription

Default event name: Subscribe

Parameters:

  • alias: String

  • fb_content_id: String

  • _valueToSum: Float

  • fb_currency: String

  • fb_num_items = 1

  • offer_id: String

  • offer_type: String

Failed conversion from promotional offer to regular subscription or failed renew

Default event name: apphud_promo_expired

Parameters:

  • alias = "apphud_promo_expired"

  • fb_content_id: String

  • reason: Float

  • offer_id: String

  • offer_type: String

Refund during promotional offer

Default event name: Subscribe

Parameters:

  • alias: String

  • fb_content_id: String

  • _valueToSum: Float

  • fb_currency: String

  • fb_num_items = 1

  • reason: String

  • offer_id: String

  • offer_type: String

Other Events

Non renewing purchase

Default event name: fb_mobile_purchase

Parameters:

  • alias: String

  • fb_content_id: String

  • _valueToSum: Float

  • fb_currency: String

  • fb_num_items = 1

Non renewing purchase refunded

Default event name: fb_mobile_purchase

Parameters:

  • alias: String

  • fb_content_id: String

  • _valueToSum: Float

  • fb_currency: String

  • fb_num_items = 1

  • reason: String

Billing Issue

Default event name: apphud_billing_issue

Parameters:

  • alias = "apphud_billing_issue"

  • fb_content_id: String

Billing issue Resolved

Default event name: [Apphud] billing_issue_resolved

Parameters:

  • product_id: String

  • alias = "apphud_billing_issue_resolved"

Testing Subscription Events

Step 1
2
3
4
5
✅ 6
Step 1

Make sure Facebook SDK is properly integrated in your app and Facebook integration is configured in Apphud.

2

Install Facebook app into your test device and sign in .

3

Open Facebook Events Manager, select your app and open "Test Events" tab:

4

Open Xcode, remove your app from test device and launch the app.

5

Make a test purchase in your app.

You can read more about testing purchases here.

✅ 6

You will see Apphud events on Facebook in a real time:

How to Use these Events?

You may use events coming from Apphud to Facebook to:

  • analyze your app metrics on Facebook Analytics;

  • view cost per app event on Facebook Ads Manager and Facebook Ad Reports;

  • create Facebook Lookalike audiences based on events.

It may take up to 24 hours from sending events from Apphud before they will appear on Facebook.

Facebook Analytics

Open Facebook Analytics and select your app. On "Revenue" tab you may see key revenue metrics calculated on events received from Apphud:

Or you may create event breakdown table by a set of properties. For example, here is Subscribe event breakdown by user's language:

Facebook Ads and Ad Reports

View subscription metrics right on Facebook Ads Manager. Open Facebook Ads Manager, click on "Columns" and select "Customize Columns...":

Add necessary columns. For example, subscriptions and trials total count, value and cost:

You may optionally save this customized view as a preset. Since now, you will be able to see these metrics right on Facebook Ads Manager:

You can also add subscription metrics to Facebook Ads report:

Facebook Lookalike Audience

Create Lookalike audience and launch Facebook Ads targeted on people who most likely will perform desired event. For example, create Lookalike audience based on people who recently purchased a subscription.

Step 1
2
3
4
5
6
7
✅ 8
Step 1

Open Facebook Audiences Tool and select your Facebook Ads account in the dropdown in the top left corner.

2

Select “Create Audience” > “New Lookalike audience”:

3

Click on “Create New Source” > “Custom Audience”:

4

Select “App Activity”:

5

Select your app and Subscribe event. You may optionally choose a date range to include only users who made a purchase recently:

6

Name your audience and save.

7

Select location of people of your future audience and define audience size. Audience size ranges from 1% to 10%, where 1% is the closes to the target audience.

✅ 8

Once created, you will be able to choose this Lookalike audience while setting up Ad Set:

Read a post called "4 tricks on launching Facebook Ads for iOS app with subscriptions" in our blog, where we desribe several tactics to launch successful Facebook ad campaigns.