Facebook Ads

Learn how to set up integration with Facebook Ads

To integrate Facebook Ads go to Integrations > Facebook Ads and set credentials.

Facebook Ads integration is different from all others. Usually, companies create ads using Facebook and would like to optimize campaigns based on customer's behavior. Optimization is available only for Facebook standard events. That's why editing event name is not available for Facebook Ads integration. Adapty properly maps customers event into Facebook events in the following way

Adapty eventFacebook Ads event
Subscription initial purchaseSubscribe
Subscription renewedSubscribe
Subscription cancelledCancelSubscription
Trial startedStartTrial
Trial convertedSubscribe
Trial cancelledCancelTrial
Non subscription purchasefb_mobile_purchase
Billing issue detectedbilling_issue_detected
Entered grace periodentered_grace_period
Auto renew offauto_renew_off
Auto renew onauto_renew_on
Auto renew off subscriptionauto_renew_off_subscription
Auto renew on subscriptionauto_renew_on_subscription

StartTrial, Subscribe, CancelSubscription are standard events.

You need an application on Facebook Developers platform. Log in to your app and then find advanced settings.

Find the App ID in the header.

🚧

Disable in-app events logging in the Facebook SDK to avoid duplications

Open your App Dashboard and navigate to Analytics->Settings. Then set Log In-App Events Automatically to No and click Save Changes.

2844

Disable in-app events logging in the Facebook SDK to avoid duplications

SDK configuration

🚧

Because of iOS IDFA changes in iOS 14.5, if you use Facebook integration, make sure you send facebookAnonymousId to Adapty via .updateProfile() method. It allows Facebook to handle events if IDFA is not available.

let builder = AdaptyProfileParameters.Builder()
    .with(facebookAnonymousId: FBSDKCoreKit.AppEvents.anonymousID)

Adapty.updateProfile(params: builder.build()) { error in
    if error != nil {
        // handle the error                        
    }
}
val builder = AdaptyProfileParameters.Builder()
    .withFacebookAnonymousId(AppEventsLogger.getAnonymousAppDeviceGUID(context))
  
Adapty.updateProfile(builder.build()) { error ->
    if (error == null) {
        // successful update
    }
}
There is no official SDK for Flutter
import { adapty } from 'react-native-adapty';
import { AppEventsLogger } from 'react-native-fbsdk-next';

try {
  const anonymousId = await AppEventsLogger.getAnonymousID();

  await adapty.updateProfile({
    facebookAnonymousId: anonymousId,
  });
} catch (error) {
    // handle `AdaptyError`
}
anonymousID is not available in the official SDK
https://github.com/facebook/facebook-sdk-for-unity/issues/676