You can configure expo-ads-facebook using its built-in config plugin if you use config plugins in your project (EAS Build or expo run:[android|ios]). The plugin allows you to configure various properties that cannot be set at runtime and require building a new app binary to take effect.
In the Expo Go app, all of your Facebook API calls will be made with Expo's Facebook App ID. This means you will not see any related ad info in your Facebook developer page while running your project in Expo Go.
To use your app's own Facebook App ID (and thus see any related ad info in your Facebook developer page), you'll need to build a standalone app.
Are you using the classic build system? (expo build:[android|ios])
{"expo":{"facebookScheme":"fb1234567891234567","facebookAppId":"1234567891234567","facebookDisplayName":"My name","facebookAutoLogAppEventsEnabled":true,"facebookAdvertiserIDCollectionEnabled":true,"plugins":[["expo-ads-facebook",{"userTrackingPermission":"This identifier will be used to deliver personalized ads to you."}]]}}
When using Facebook Ads in development, you can use Facebook's test ad IDs so that there's minimal setup needed on your part. Wherever a placementId is required, simply provide DEMO_AD_TYPE#YOUR_PLACEMENT_ID where DEMO_AD_TYPE is one of the values shown here in the "Demo Ad Type Table".
Another option is to add the following at the top of your file to register your device:
Interstitial Ad is a type of ad that displays a full-screen modal dialog with media content. It has a dismiss button as well as a touchable area that takes the user outside of your app to the advertised content.
The method returns a promise that will be rejected when an error occurs during a call (e.g. no fill from ad server or network error) and resolved when the user either dismisses or interacts with the displayed ad.
Next, you need to wrap the component you want to use to show your add with the withNativeAd higher-order component. The wrapped component will receive a prop named nativeAd, which you can use to render an ad.
AdMediaView displays native ad media content whereas AdIconView is responsible for displaying an ad icon.
Note: Don't use more than one AdMediaView and AdIconView component (each) within one native ad. If you use more, only the last mounted one will be populated with ad content.
If you want, you can optionally pass two other callback properties — onAdLoaded and onError.
onAdLoaded will be called once an ad is fetched and provided to your component (the nativeAd property introduced in step 2.) The one and only argument with which the function will be called will be the native ad object.
onError will be called if the Audience framework encounters an error while fetching the ad. The one and only argument with which the function will be called will be an instance of Error.
By default the native ads manager will refresh its ads periodically. This does not mean that any ads which are shown in the application's UI will be refreshed, but requesting next native ads to render may return new ads at different times.
Promise will be rejected when there's an error loading ads from Facebook Audience network. It will resolve with a
boolean indicating whether user didClick an ad or not.
Note: There can be only one showAd call being performed at a time. Otherwise, an error will be thrown.
Registers given device to receive test ads. When you run app on simulator, it should automatically get added. Use it
to receive test ads in development mode on a standalone phone.
All devices should be specified before any other action takes place, like AdsManager gets created.
Clears all previously set test devices. If you want your ads to respect newly set config, you'll have to destroy and create
an instance of AdsManager once again.
Indicate to the Audience Network SDK if the user has consented to advertising tracking. This only applies to iOS 14+ and for all other versions "Limited Ad Tracking" is used. Learn more.