Facebook Ads

With the Facebook Ads integration, you can easily check your app stats in Meta Analytics. Adapty sends events to Meta Ads Manager, helping you make similar audiences based on subscriptions to get better returns. This way, you can accurately see how much money your ads are making from subscriptions.

The integration between Adapty and Facebook Ads operates in the following way: Adapty sends all subscription events that are configured in your integration to Facebook Ads. This integration is beneficial for evaluating the effectiveness of your advertising campaigns.

Set up integration

Connect Adapty to Facebook Ads

To integrate Facebook Ads and analyze your app metrics, you can set up the integration with Meta Analytics. By sending events to Meta Ads Manager, you can create lookalike audiences based on subscription events like renewals. To configure this integration, navigate to Integrations > Facebook Ads in the Adapty Dashboard and provide the required credentials.

Note

Please consider that the Facebook Ads integration works on iOS 14.5+ only for users with ATT consent.

fd84ddf-CleanShot_2023-08-15_at_15.45.442x.webp
  1. To find App ID, open your app page in App Store Connect, go to the App Information page in General section, and find Apple ID in the left bottom part of the screen.
  2. You need an application on Meta for Developers platform. Log in to your app and then find advanced settings. You can find the App ID in the header.
4b326c4-001563-August-23-4tO3JVso.webp
  1. Disable client-side tracking in your Meta SDK configuration to prevent double counting of revenue in Meta Ads Manager. You can find this setting in your Meta Developer Console under App Settings > Advanced Settings. Set Log in-app events automatically to “No”. This will ensure that revenue events are only tracked through Adapty’s integration.

    To track install and usage events, you’ll need to activate Meta SDK in your code. You can find implementation details in the Meta SDK documentation for your platform:

c4eb8eb-001565-August-23-483KKBbC.webp

You can use this integration with Android apps as well. If you set up Android SDK configuration in the App Settings, setting up the Facebook App ID is enough.

Configure events and tags

Adapty maps its purchase events to Meta’s standard events, which Meta can optimize campaigns on: StartTrial, Subscribe, and fb_mobile_purchase, Meta’s purchase event. Subscription started, Subscription renewed, Trial started, and Trial converted each send one Meta event for every name selected in the event’s field, and all names are selected by default. A trial start, for example, reaches Meta as three events. To send fewer, remove names from the field.

Adapty eventDefault Meta events
Subscription startedSubscribe, fb_mobile_purchase
Subscription renewedSubscribe, fb_mobile_purchase
Trial startedStartTrial, Subscribe, fb_mobile_purchase
Trial convertedSubscribe, fb_mobile_purchase
Non-subscription purchasefb_mobile_purchase

Meta has no standard event for the remaining events, so Adapty sends them as custom events under their Adapty names. To match your own naming, change the name in the event’s field.

Adapty eventDefault Meta event
Subscription expired (Churned)subscription_expired
Subscription renewal cancelledsubscription_renewal_cancelled
Subscription renewal reactivatedsubscription_renewal_reactivated
Subscription paused (Android only)subscription_paused
Subscription deferred (Android only)subscription_deferred
Subscription refundedsubscription_refunded
Trial expiredtrial_expired
Trial renewal cancelledtrial_renewal_cancelled
Trial renewal reactivatedtrial_renewal_reactivated
Entered grace periodentered_grace_period
Billing issue detectedbilling_issue_detected
Non-subscription purchase refundednon_subscription_purchase_refunded
Trial still activetrial_active
Subscription still activesubscription_active

Trial still active and Subscription still active are synthetic events: Adapty sends them to Meta on a timer, and only if the trial or subscription is still running when the timer expires. They carry no revenue, so Meta doesn’t count them toward purchase value. Both are off by default. To send them, turn them on and set the delay.

8a5df9d-CleanShot_2023-07-04_at_12.47.312x.webp

Connect your app to Facebook Ads

If you follow the steps above, Facebook will automatically receive subscription data from Adapty.

Following the changes to IDFA in iOS 14.5, we recommend that you request the user’s facebookAnonymousId from Facebook. That way, if the user’s IDFA is unavailable, the integration will continue to function. Follow the set user attributes guide to set this parameter.

Event structure

Adapty sends events to Facebook Ads (Meta) via the Graph API. Each event is structured like this:

{
  "event": "CUSTOM_APP_EVENTS",
  "app_user_id": "user_12345",
  "advertiser_id": "00000000-0000-0000-0000-000000000000",
  "advertiser_tracking_enabled": 1,
  "application_tracking_enabled": 1,
  "custom_events": "[{\"_eventName\":\"Subscribe\",\"_logTime\":1709294400,\"fb_num_items\":1,\"fb_content_type\":\"in_app\",\"fb_content_id\":\"yearly.premium.6999\",\"fb_currency\":\"USD\",\"fb_order_id\":\"GPA.3383...\",\"fb_transaction_id\":\"GPA.3383...\",\"_valueToSum\":9.99}]",
  "extinfo": "[\"i2\",\"com.example.app\",\"1.0.0\",\"100\",\"17.0.1\",\"iPhone14,3\",\"en_US\",\"GMT+3\",\"\",0,0,0,0,0,0,\"GMT+3\"]",
  "anon_id": "facebook_anon_id_123"
}

Where:

ParameterTypeDescription
eventStringAlways “CUSTOM_APP_EVENTS”.
app_user_idStringThe user’s Customer User ID.
advertiser_idStringOn iOS, the IDFA, or the IDFV when the IDFA is unavailable. On Android, the Advertising ID. When the profile has no device ID, 00000000-0000-0000-0000-000000000000.
advertiser_tracking_enabledInteger1 if tracking is enabled (ATT authorized), 0 otherwise.
application_tracking_enabledIntegerAlways 1.
custom_eventsStringJSON-encoded string of event objects (see below).
extinfoStringJSON-encoded string containing app/device info (e.g., version, OS, locale).
anon_idStringFacebook Anonymous ID (if available).

The custom_events parameter is a JSON-encoded array with one object for each Meta event the Adapty event maps to. Only StartTrial, Subscribe, and fb_mobile_purchase carry fb_content_id, fb_content_type, fb_num_items, and fb_transaction_id. Each object contains:

ParameterTypeDescription
_eventNameStringThe Meta Ads event name (e.g., “Subscribe”).
_logTimeLongTimestamp of the event in seconds.
_valueToSumFloatRevenue amount.
fb_content_idStringThe Product ID from the store.
fb_currencyStringCurrency code (e.g., “USD”).
fb_order_idStringOriginal transaction ID.
fb_transaction_idStringOriginal transaction ID.
fb_content_typeStringAlways “in_app”.
fb_num_itemsIntegerAlways 1 for purchase events.

Troubleshooting

access_level_updated shows as failed in the Event Feed

access_level_updated is a webhook-only event. Adapty never sends it to this integration. But Adapty records an outcome for every enabled integration, and an unsupported event is displayed as a failure.