Facebook app SDK for dynamic ads
This article is a guide explaining how to modify your Facebook app SDK to support dynamic ads campaigns. To learn about the modifications required to the Meta Pixel, see Meta Pixel modifications for dynamic ads.
You can check Facebook's documentation for the most up-to-date instructions. Only the Set Up App Events section is relevant when creating the Dynamic Ads campaigns with Smartly.
You can configure the mobile SDK to send the following events.
iOS event | Android event |
---|---|
FBSDKAppEventNameViewedContent | EVENT_NAME_VIEWED_CONTENT |
FBSDKAppEventNameAddedToCart | EVENT_NAME_ADDED_TO_CART |
FBSDKAppEventNamePurchased | EVENT_NAME_PURCHASED |
Controlling target audience with additional custom parameters
Additional custom parameters can be used to control audience sources in retargeting DPA campaigns. These are fully optional and DPA campaigns can be run also without them.
Adding custom parameters such as deviceType or OS can be used to later separate people viewing products in mobile app and website from each other and targeting them in separate campaigns or adsets.
Examples of triggering events via mobile SDK
iOS
Customer added one product to cart:
[FBSDKAppEvents logEvent:FBSDKAppEventNameAddedToCart
valueToSum:54.23
parameters:@{
FBSDKAppEventParameterNameCurrency : @"USD",
FBSDKAppEventParameterNameContentType : @"product",
FBSDKAppEventParameterNameContentID : @"1234ABCD"
}
];
Android
Customer purchased two products:
Bundle parameters = new Bundle();
parameters.putString(AppEventsConstants.EVENT_PARAM_CURRENCY, "USD");
parameters.putString(AppEventsConstants.EVENT_PARAM_CONTENT_TYPE, "product");
parameters.putString(AppEventsConstants.EVENT_PARAM_CONTENT_ID, "[\"1234\",\"5678\"]");
logger.logEvent(
AppEventsConstants.EVENT_NAME_PURCHASED,
54.23,
parameters
);
Verifying app events
Facebook Analytics
To ensure your App Events are being sent correctly, you can check your recent events in Facebook Analytics for Apps under Activity → Event Debugging.
If you do not have your app App Events set up yet, you can check out Facebook Analytics Demo to explore the Analytics for Apps tool.
Facebook App Ads Helper
Alternatively, you can use Facebook App Ads Helper to see the app events in real time as you use your app.