description |
---|
This guide describes how to add and configure Facebook Evens Manager 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.
{% hint style="danger" %} Since iOS 14.5 integration works only for users that consented tracking. Learn more. {% endhint %}
{% hint style="info" %} Please make sure that you disabled Facebook Automatic Purchase Events Logging in app settings or consider changing event mapping so that native Facebook SDK events are not mixed with Apphud events. See step 7 for details. {% endhint %}
{% tabs %} {% tab title="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. {% endtab %}
{% tab title="2" %} Open your Facebook app settings and copy your App ID:
{% tab title="3" %} Under Advanced section copy Client Token:
{% tab title="4" %} Enter App ID and Client Token fields:
{% tab title="5" %} 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.
{% tab title="6" %} 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:
{% tab title="7" %}
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.
{% tab title="✅ 8" %} Enable Integration and save changes:
In case of Facebook attribution, you should pass empty data:
{% tabs %} {% tab title="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()
}
{% endtab %}
{% tab title="Objective-C" %}
// Initialize Apphud
// ...
// Initialize Facebook
// ...
[Apphud addAttributionWithData:@{} from:ApphudAttributionProviderFacebook identifer:nil callback:^(BOOL result) {}];
// ...
- (void)applicationDidBecomeActive:(UIApplication *)application {
[FBSDKAppEvents activateApp];
}
{% endtab %}
{% tab title="Kotlin" %}
// Initialize Apphud
// ...
// Initialize Facebook
// ...
Apphud.addAttribution(ApphudAttributionProvider.facebook)
// track installs manually
AppEventsLogger.activateApp(this)
{% endtab %} {% endtabs %}
While configuring integration you can also choose between sending revenue as sales or proceeds (without Apple / Google 15%-30% commission).
{% hint style="info" %} You can read more how Apple calculates commission here. {% endhint %}
Starting iOS 14.5 access to IDFA requires user consent. You should request IDFA manually using AppTrackingTransparency framework and pass it to Apphud. Read more here.
This is a list of all possible events and their parameters that are being sent to AppsFlyer.
{% hint style="info" %} You can read more about subscription events here and parameters here. {% endhint %}
{% tabs %} {% tab title="Trial" %}
Default event name: StartTrial
Parameters:
alias
: Stringfb_content_id
: String_valueToSum
: Floatfb_currency
: Stringfb_num_items
= 1offer_type
= "trial"
Default event name: Subscribe
Parameters:
alias
: Stringfb_content_id
: String_valueToSum
: Floatfb_currency
: Stringfb_num_items
= 1offer_type
= "trial"
Default event name: apphud_trial_expired
Parameters:
alias
= "apphud_trial_expired"fb_content_id
: Stringreason
: String {% endtab %}
{% tab title="Cancellations" %}
Default event name: apphud_trial_canceled
Parameters:
alias
= "apphud_trial_canceled"fb_content_id
: String
Default event name: apphud_subscription_canceled
Parameters:
alias
= "apphud_subscription_canceled"fb_content_id
: String
Default event name: apphud_autorenew_disabled
Parameters:
alias
= "apphud_autorenew_disabled"fb_content_id
: String
Default event name: apphud_autorenew_enabled
Parameters:
alias
= "apphud_autorenew_enabled"fb_content_id
: String {% endtab %}
{% tab title="Introductory Offer" %}
Default event name: Subscribe
Parameters:
alias
: Stringfb_content_id
: String_valueToSum
: Floatfb_currency
: Stringfb_num_items
= 1offer_type
: String
Default event name: Subscribe
Parameters:
alias
: Stringfb_content_id
: String_valueToSum
: Floatfb_currency
: Stringfb_num_items
= 1offer_type
: String
Default event name: Subscribe
Parameters:
alias
: Stringfb_content_id
: String_valueToSum
: Floatfb_currency
: Stringfb_num_items
= 1offer_type
: String
Default event name: apphud_intro_expired
Parameters:
alias
= "apphud_intro_expired"fb_content_id
: Stringreason
: Floatoffer_type
: String
Default event name: Subscribe
Parameters:
alias
: Stringfb_content_id
: String_valueToSum
: Floatfb_currency
: Stringfb_num_items
= 1reason
: Stringoffer_type
: String {% endtab %}
{% tab title="Regular" %}
Default event name: Subscribe
Parameters:
alias
: Stringfb_content_id
: String_valueToSum
: Floatfb_currency
: Stringfb_num_items
= 1
Default event name: Subscribe
Parameters:
alias
: Stringfb_content_id
: String_valueToSum
: Floatfb_currency
: Stringfb_num_items
= 1
Default event name: apphud_subscription_expired
Parameters:
alias
= "apphud_subscription_expired"fb_content_id
: Stringreason
: Float
Default event name: Subscribe
Parameters:
alias
: Stringfb_content_id
: String_valueToSum
: Floatfb_currency
: Stringfb_num_items
= 1reason
: String {% endtab %}
{% tab title="Promo Offer" %}
Default event name: StartTrial
or Subscribe
depending on promo offer type.
Parameters:
alias
: Stringfb_content_id
: String_valueToSum
: Floatfb_currency
: Stringfb_num_items
= 1offer_id
: Stringoffer_type
: String
Default event name: StartTrial
or Subscribe
depending on promo offer type.
Parameters:
alias
: Stringfb_content_id
: String_valueToSum
: Floatfb_currency
: Stringfb_num_items
= 1offer_id
: Stringoffer_type
: String
Default event name: Subscribe
Parameters:
alias
: Stringfb_content_id
: String_valueToSum
: Floatfb_currency
: Stringfb_num_items
= 1offer_id
: Stringoffer_type
: String
Default event name: apphud_promo_expired
Parameters:
alias
= "apphud_promo_expired"fb_content_id
: Stringreason
: Floatoffer_id
: Stringoffer_type
: String
Default event name: Subscribe
Parameters:
alias
: Stringfb_content_id
: String_valueToSum
: Floatfb_currency
: Stringfb_num_items
= 1reason
: Stringoffer_id
: Stringoffer_type
: String {% endtab %}
{% tab title="Other Events" %}
Default event name: fb_mobile_purchase
Parameters:
alias
: Stringfb_content_id
: String_valueToSum
: Floatfb_currency
: Stringfb_num_items
= 1
Default event name: fb_mobile_purchase
Parameters:
alias
: Stringfb_content_id
: String_valueToSum
: Floatfb_currency
: Stringfb_num_items
= 1reason
: String
Default event name: apphud_billing_issue
Parameters:
alias
= "apphud_billing_issue"fb_content_id
: String
Default event name: [Apphud] billing_issue_resolved
Parameters:
product_id
: Stringalias
= "apphud_billing_issue_resolved {% endtab %} {% endtabs %}
You may use events coming from Apphud to Facebook to:
- view cost per app event on Facebook Ads Manager and Facebook Ad Reports;
- create Facebook Lookalike audiences based on events.
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:
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.
{% tabs %} {% tab title="Step 1" %} Open Facebook Audiences Tool and select your Facebook Ads account in the dropdown in the top left corner. {% endtab %}
{% tab title="2" %} Select “Create Audience” > “New Lookalike audience”:
{% tab title="3" %} Click on “Create New Source” > “Custom Audience”:
{% tab title="4" %} Select “App Activity”:
{% tab title="5" %}
Select your app and Subscribe
event. You may optionally choose a date range to include only users who made a purchase recently:
{% tab title="6" %} Name your audience and save. {% endtab %}
{% tab title="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.
{% tab title="✅ 8" %} Once created, you will be able to choose this Lookalike audience while setting up Ad Set:
{% hint style="info" %} 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. {% endhint %}
If you don't see events in your Facebook Analytics and Ads Manager, please check the following:
- If you run SKAdNetwork campaigns make sure your target app event is in top priority of SKAdNetwork App Events configuration. If your main goal is
Purchase
event, then it should have the greatest conversion value. You can view and edit your App Events configuration for SKAdNetwork in your app's settings in Events Manager.
- Keep in mind that integration works only for users that consented tracking. In other words IDFA is required for App Event to be processed by Facebook. Learn more.
- If you have low number of installs, then SKAdNetwork may report null conversion values due to Apple Privacy Threshold. The more app installs you get, the more accurate SKAdNetwork campaign will be. Learn more.
- Try to wait a few more hours, sometimes events appear in Events Manager / Ads Manager after up to 24 hours.
- Make sure you are viewing events in correct category. Events that are being sent by Apphud are mapped to Facebook Standard events, like
Purchase
,Subscribe
, etc. You can view and edit events mapping in Facebook Integration page in Apphud. In the given example,Trial Converted
event is mapped toSubscribe
standard event in Facebook
- Verify that events are sent in Apphud Events page. Click "
Integrations: sent
" link and view event logs:
- Make sure you are using latest Facebook iOS SDK or Facebook Android SDK.
- In Overview tab in the Events Manager you can see Recent Activity of your events, like Subscribe:
- View Detailed information about the last 100 events received, including parameters that were sent by Apphud:
- View your app events Diagnostics: