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 event | Facebook Ads event |
---|---|
Subscription initial purchase | Subscribe |
Subscription renewed | Subscribe |
Subscription cancelled | CancelSubscription |
Trial started | StartTrial |
Trial converted | Subscribe |
Trial cancelled | CancelTrial |
Non subscription purchase | fb_mobile_purchase |
Billing issue detected | billing_issue_detected |
Entered grace period | entered_grace_period |
Auto renew off | auto_renew_off |
Auto renew on | auto_renew_on |
Auto renew off subscription | auto_renew_off_subscription |
Auto renew on subscription | auto_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.

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
Updated about 1 month ago