This guide is intended for publishers who want to use the Google Mobile Ads SDK to load and display ads from the Facebook Audience Network via waterfall and Open Bidding mediation. It covers how to add Facebook Audience Network ads to an ad unit's mediation configuration and how to integrate the Facebook Audience Network SDK and adapter into an iOS app.
Supported ad formats and features
The AdMob mediation adapter for the Facebook Audience Network has the following capabilities:
Formats | |
---|---|
Banners | |
Interstitials | |
Rewarded video | |
Rewarded Video (new APIs) | |
Native Ads | |
Features | |
Smart banners | |
Ad Network Optimization (ANO) | |
Native Video | |
Open Bidding | 1 |
Requirements
- iOS deployment target of 9.0 or higher
[For Open Bidding]: Facebook Audience Network adapter 5.10.0.0 or higher (latest version recommended)
The latest Facebook Audience Network SDK usually requires the latest version of Xcode
- Latest Google Mobile Ads SDK
Step 1: Set up Facebook Audience Network
Sign up and Log in to the Business Manager Start page.
Click Create a new Business Manager account and fill out the required fields with your business details.
Create a Facebook property
Once you've filled out the required information, you'll be prompted to create a property for your app. Enter the desired name of the property for your app and click Go to Monetization Manager.
Next, select iOS as the platform to monetize.
Indicate whether or not your app is live and click Submit.

You will be prompted to create an ad placement for your application. Select a format, fill out the form and click Next.
Waterfall
Open Bidding
The next step presents an overview of the placement you created. Take note of the Placement ID under the Add placement ID section. Additionally, you will also need your System User Access Token. Simply click the Generate Token button under the Add system user access token section to generate it. You will need both the Placement ID and the System User Access Token when you set up your ad unit ID.
Step 2: Configure mediation settings for your AdMob ad unit
You need to add Facebook to the mediation configuration for your ad unit. First sign in to your AdMob account.
Navigate to the Mediation tab. If you have an existing mediation group you'd like to modify, click the name of that mediation group to edit it, and skip ahead to Add Facebook Audience Network as an ad source.
To create a new mediation group, select Create Mediation Group.
Enter your ad format and platform, then click Continue.

Give your mediation group a name, and select locations to target. Next, set the mediation group status to Enabled. Then click Add Ad Units, which will open up the ad unit selection overlay.

Associate this mediation group with your existing AdMob ad unit. Then click Done.

You should now see the ad units card populated with the ad units you selected.

Add Facebook Audience Network as an ad source
Waterfall
In the Ad Sources card, select Add Ad Network.
Select Facebook Audience Network. Enable the Optimize switch. Enter the System User Access Token and Property ID obtained in the previous section. App Access Token is deprecated and can be left blank. Review and check the Authorization checkbox to set up Ad Network Optimization (ANO) for Facebook Audience Network. Then enter an eCPM value for Facebook Audience Network and click Continue.
Enter the Placement ID obtained in the previous section. Then click Done.
Finally, click Save.
Open Bidding
In the Ad Sources card, select Add Ad Network. Select Facebook Audience Network (Open Bidding). Enter the Placement ID obtained in the previous section and click Done.
Finally, click Save.
Using rewarded video ads
In the settings for your rewarded video ad unit, provide values for the reward amount and reward type. Then, to ensure you provide the same reward to the user no matter which ad network is served, check the Apply to all networks in Mediation groups box.
If you don't apply this setting, the Facebook adapter defaults to a reward
of type ""
(empty string) with a value of 1
. The Facebook SDK does not
provide specific reward values for its rewarded video ads.
Step 3: Import the Facebook Audience Network SDK and adapter
Using CocoaPods (recommended)
Add the following line to your project's Podfile:
pod 'GoogleMobileAdsMediationFacebook'
From the command line run:
pod install --repo-update
Manual integration
- Download the latest version of the
Facebook Audience Network SDK for iOS
and link
FBAudienceNetwork.framework
in your project. - Download the latest version of the
Facebook adapter
and link
FacebookAdapter.framework
in your project.
Step 4: Additional code required
Advertising tracking enabled
If you are building for iOS 14 or later, Facebook requires that you explicitly set their Advertising Tracking Enabled flag using the following code:
Swift
// Set the flag as true
FBAdSettings.setAdvertiserTrackingEnabled(true)
Objective-C
// Set the flag as true.
[FBAdSettings setAdvertiserTrackingEnabled:YES];
SKAdNetwork integration
Facebook asks that you add the following
SKAdNetwork
identifiers to your project's Info.plist
file:
<array>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>v9wttpbfk9.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>n38lu8286q.skadnetwork</string>
</dict>
</array>
Step 5: Test your implementation
See the Testing Audience Network Implementation guide guide for detailed instructions on how to enable Facebook test ads. You can then use the Mediation Test Suite to verify if your implementation is correct.
That's it! You now have a working mediation integration with Facebook's Audience Network.
Optional steps
EU Consent and GDPR
Under the Google EU User Consent Policy, you must ensure that certain disclosures are given to, and consents obtained from, users in the European Economic Area (EEA) regarding the use of device identifiers and personal data. This policy reflects the requirements of the EU ePrivacy Directive and the General Data Protection Regulation (GDPR). When seeking consent, you must identify each ad network in your mediation chain that may collect, receive, or use personal data and provide information about each network's use. Google currently is unable to pass the user's consent choice to such networks automatically.
Please review Facebook's guidance for information about GDPR and Facebook advertising.
CCPA
The California Consumer Privacy Act (CCPA) requires giving California state residents the right to opt out of the "sale" of their "personal information" (as the law defines those terms), with the opt-out offered via a prominent "Do Not Sell My Personal Information" link on the "selling" party's homepage. The CCPA preparation guide offers the ability to enable restricted data processing for Google ad serving, but Google is unable to apply this setting to each ad network in your mediation chain. Therefore, you must identify each ad network in your mediation chain that may participate in the sale of personal information and follow guidance from each of those networks to ensure compliance with CCPA.
Please review Facebook's documentation for data processing options for users in California.
Using native ads
Some Facebook native ad assets do not map one to one to Google native ad assets.
Such assets are passed back to the publisher in the extraAssets
property of
GADNativeAd
. Here's a code example showing how to extract these assets:
Swift
let socialContext: String = unifiedNativeAd.extraAssets[GADFBSocialContext]
Objective-C
NSString *socialContext = unifiedNativeAd.extraAssets[GADFBSocialContext];
Using Facebook Native Ads without a MediaView
Facebook's native ad format requires rendering the
GADMediaView
asset. If you plan to render native ads without that asset, make sure to use
Facebook's
native banner
ad format.
To use Facebook's native banner ads instead, you must:
- Select the
Native Banner
format when setting up Facebook Audience Network.
- Use Facebook adapter 5.5.0.0 or higher.
For waterfall mediation, pass an extra parameter into the ad request indicating you want to request a native banner ad, as shown below.
Swift
#import "FacebookAdapter.h"
//...
let request = GADRequest()
let extras = GADFBNetworkExtras()
extras.nativeAdFormat = GADFBAdFormatNativeBanner
request.register(extras)
Objective-C
#import <FacebookAdapter/FacebookAdapter.h>
//...
GADRequest *request = [GADRequest request];
GADFBNetworkExtras * extras = [[GADFBNetworkExtras alloc] init];
extras.nativeAdFormat = GADFBAdFormatNativeBanner;
[request registerAdNetworkExtras:extras];
Ad rendering
The Facebook adapter returns its native ads as UnifiedNativeAd
objects.
It populates the following
Native ads advanced field descriptions
for a
GADUnifiedNativeAd
.
Field | Populated by Facebook adapter |
---|---|
Headline | |
Image | 1 |
Body | |
App icon | |
Call to action | |
Advertiser Name | |
Star rating | |
Store | |
Price |
1 The Facebook adapter
does not provide direct access to the main image asset
for its native ads. Instead, the adapter populates the
GADMediaView
with a video or an image.
Impression and click tracking
The table below demonstrates when native ad impressions and clicks are recorded by the Google Mobile Ads SDK.
Integration type | Impression recording | Click recording |
---|---|---|
Waterfall Mediation | Facebook Audience Network SDK callback | Facebook Audience Network SDK callback |
Open Bidding | 1px of native ad on screen + asset rendering requirements | Facebook Audience Network SDK callback |
Facebook native format | Required asset | Required rendering class |
---|---|---|
Native | Media View |
GADMediaView
|
Native Banner | App icon |
UIImageView
|
Error codes
If the adapter fails to receive an ad from the Facebook Audience Network,
publishers can check the underlying error from the ad response using
GADResponseInfo.adNetworkInfoArray
under the following classes:
GADMAdapterFacebook
GADMediationAdapterFacebook
Here are the codes and accompanying messages thrown by the Facebook Audience Network adapter when an ad fails to load:
Error code | Reason |
---|---|
101 | Invalid server parameters (e.g. missing Placement ID). |
102 | The requested ad size does not match a Facebook Audience Network supported banner size. |
103 | The Facebook Audience Network ad object failed to initialize. |
104 | The Facebook Audience Network SDK failed to present their interstitial/rewarded ad. |
105 | Root view controller of the banner ad is nil . |
106 | The Facebook Audience Network SDK failed to initialize. |
1000-9999 | The Facebook Audience Network returned an SDK-specific error. See Facebook's documentation for more details. |
Facebook iOS Mediation Adapter Changelog
Version 6.3.0.0
- Verified compatibility with FAN SDK 6.3.0.
- Now requires Google Mobile Ads SDK version 8.1.0 or higher.
- Removing support for the
arm64
architecture for iOS simulators, as Facebook Audience Network SDK does not yet support it.
Built and tested with
- Google Mobile Ads SDK version 8.1.0.
- FAN SDK version 6.3.0.
Version 6.2.1.2
- Added support for the
arm64
architecture for iOS simulators.
Built and tested with
- Google Mobile Ads SDK version 8.0.0.
- FAN SDK version 6.2.1.
Version 6.2.1.1
- Updated the adapter to use the
.xcframework
format. - Now requires Google Mobile Ads SDK version 8.0.0 or higher.
Built and tested with
- Google Mobile Ads SDK version 8.0.0.
- FAN SDK version 6.2.1.
Version 6.2.1.0
- Verified compatibility with FAN SDK 6.2.1.
- Now requires Google Mobile Ads SDK version 7.69.0 or higher.
Built and tested with
- Google Mobile Ads SDK version 7.69.0.
- FAN SDK version 6.2.1.
Version 6.2.0.0
- Verified compatibility with FAN SDK 6.2.0.
- Now requires Google Mobile Ads SDK version 7.67.0 or higher.
Built and tested with
- Google Mobile Ads SDK version 7.67.0.
- FAN SDK version 6.2.0.
Version 6.0.0.0
- Verified compatibility with FAN SDK 6.0.0.
- Now requires Google Mobile Ads SDK version 7.66.0 or higher.
Built and tested with
- Google Mobile Ads SDK version 7.66.0.
- FAN SDK version 6.0.0.
Version 5.10.1.0
- Verified compatibility with FAN SDK 5.10.1.
- Now requires Google Mobile Ads SDK version 7.62.0 or higher.
- Fixed a bug where adapterWillLeaveApplication: was not being called for interstitial ads for non-open bidding.
Built and tested with
- Google Mobile Ads SDK version 7.62.0.
- FAN SDK version 5.10.1.
Version 5.10.0.0
- Verified compatibility with FAN SDK 5.10.0.
- Now requires Google Mobile Ads SDK version 7.61.0 or higher.
Built and tested with
- Google Mobile Ads SDK version 7.61.0.
- FAN SDK version 5.10.0.
Version 5.9.0.1
- Added support for rewarded interstitial ads.
- Now requires Google Mobile Ads SDK version 7.60.0 or higher.
Built and tested with
- Google Mobile Ads SDK version 7.60.0.
- FAN SDK version 5.9.0.
Version 5.9.0.0
- Verified compatibility with FAN SDK 5.9.0.
- Now requires Google Mobile Ads SDK version 7.59.0 or higher.
Built and tested with
- Google Mobile Ads SDK version 7.59.0.
- FAN SDK version 5.9.0.
Version 5.8.0.2
- Adapter now calls adapterWillPresentScreen: immediately followed by adapterDidDismissScreen: if interstitial ads fail to present.
- Fixed a bug where some banner requests failed with reason "Display format doesn't match".
Built and tested with
- Google Mobile Ads SDK version 7.58.0.
- FAN SDK version 5.8.0.
Version 5.8.0.1
- Fix bug introduced in 5.6.1.0 where
tagForChildDirectedTreatment
was incorrectly mapped to Facebook'ssetMixedAudience
method.
Built and tested with
- Google Mobile Ads SDK version 7.57.0.
- FAN SDK version 5.8.0
Version 5.8.0.0 (Deprecated, use 5.8.0.1 or newer)
- Verified compatibility with FAN SDK 5.8.0.
- Adapter now returns a non-zero
mediaContent
aspect ratio regardless if the media view is rendered or not.
Built and tested with
- Google Mobile Ads SDK version 7.57.0.
- FAN SDK version 5.8.0.
Version 5.7.1.2 (Deprecated, use 5.8.0.1 or newer)
- Added standardized adapter error codes and messages.
Built and tested with
- Google Mobile Ads SDK version 7.56.0.
- FAN SDK version 5.7.1.
Version 5.7.1.1 (Deprecated, use 5.8.0.1 or newer)
- Removed support for the i386 architecture.
Built and tested with
- Google Mobile Ads SDK version 7.56.0.
- FAN SDK version 5.7.1.
Version 5.7.1.0 (Deprecated, use 5.8.0.1 or newer)
- Verified compatibility with FAN SDK 5.7.1.
- Added support for Facebook native banner ads when using open bidding.
- Native ads now return a
GADNativeAdImage
for the icon asset.
Built and tested with
- Google Mobile Ads SDK version 7.55.1.
- FAN SDK version 5.7.1.
Version 5.7.0.0 (Deprecated, use 5.8.0.1 or newer)
- Verified compatibility with FAN SDK 5.7.0.
Built and tested with
- Google Mobile Ads SDK version 7.55.1.
- FAN SDK version 5.7.0.
Version 5.6.1.0 (Deprecated, use 5.8.0.1 or newer)
- Verified compatibility with FAN SDK 5.6.1.
Built and tested with
- Google Mobile Ads SDK version 7.53.1.
- FAN SDK version 5.6.1.
Version 5.6.0.0
- Verified compatibility with FAN SDK 5.6.0.
Built and tested with
- Google Mobile Ads SDK version 7.51.0.
- FAN SDK version 5.6.0.
Version 5.5.1.1
- Adapter now returns a non-zero
mediaContent
aspect ratio once the media view is rendered in a view. - Added additional logging for open bidding.
Version 5.5.1.0
- Verified compatibility with FAN SDK 5.5.1.
Version 5.5.0.0
- Verified compatibility with FAN SDK 5.5.0.
- Now requires Google Mobile Ads SDK version 7.46.0 or higher.
- Added support for Facebook's native banner ads.
- Added code to properly handle the completion handlers after called.
- Modified the code to follow Google's Objective-C code-style.
Version 5.4.0.0
- Verified compatibility with FAN SDK 5.4.0.
Version 5.3.2.0
- Verified compatibility with FAN SDK 5.3.2.
Version 5.3.0.0
- Changed the mediation service string include adapter version.
- Fixed a bug for native ads where AdOptions wasn't initialized correctly.
Version 5.2.0.2
- Added open bidding capability to the adapter for all ad formats.
Version 5.2.0.1
- Updated the adapter to use the new rewarded API.
- Now requires Google Mobile Ads SDK version 7.41.0 or higher.
Version 5.2.0.0
- Verified compatibility with FAN SDK 5.2.0.
- Replaced FBAdChoicesView with FBAdOptionsView.
Version 5.1.1.1
- Added support to populate advertiser name asset for Unified Native Ads.
Version 5.1.1.0
- Verified compatibility with FAN SDK 5.1.1.
Version 5.1.0.0
- Verified compatibility with FAN SDK 5.1.0.
Version 5.0.1.0
- Verified compatibility with FAN SDK 5.0.1.
Version 5.0.0.0
- Verified compatibility with FAN SDK 5.0.0.
Version 4.99.3.0
- Verified compatibility with FAN SDK 4.99.3.
Version 4.99.2.0
- Verified compatibility with FAN SDK 4.99.2.
Version 4.99.1.0
- Verified compatibility with FAN SDK 4.99.1.
Version 4.28.1.2
- Added
adapterDidCompletePlayingRewardBasedVideoAd:
callback to the adapter.
Version 4.28.1.1
- Set mediation service for Facebook adapter.
Version 4.28.1.0
- Verified compatibility with FAN SDK 4.28.1.
- Updated rewarded video delegate method.
Version 4.28.0.0
- Verified compatibility with FAN SDK 4.28.0.
- Added support for Google Unified Native Ads.
Version 4.27.2.0
- Verified compatibility with FAN SDK 4.27.2.
Version 4.27.1.0
- Verified compatibility with FAN SDK 4.27.1.
Version 4.27.0.0
- Verified compatibility with FAN SDK 4.27.0.
Version 4.26.1.0
- Verified compatibility with FAN SDK 4.26.1.
Version 4.26.0.0
- Added support for rewarded video ads.
- Added support for native video ads.
- Verified compatibility with FAN SDK 4.26.0.
Version 4.25.0.0
- Updated the adapter's view tracking for native ads to register individual asset views with the Facebook SDK rather than the entire ad view. This means that background (or "whitespace") clicks on the native ad will no longer result in clickthroughs.
- Verified compatibility with FAN SDK v4.25.0.
Version 4.24.0.0
- Verified compatibility with FAN SDK 4.24.0.
Version 4.23.0.1
- Added support for the
backgroundShown
property on Facebook's AdChoices view via network extras. - Updated the default AdChoices icon behaviour. The adapter lets Facebook set the default behaviour if no extras are provided.
Version 4.23.0.0
- Verified compatibility with FAN SDK 4.23.0.
Version 4.22.1.0
- Verified compatibility with FAN SDK 4.22.1.
- Removed the support for
armv7s
architecture.
Version 4.22.0.0
- Verified compatibility with FAN SDK 4.22.0.
Version 4.21.0.0
- Verified compatibility with FAN SDK 4.21.0.
Version 4.20.2.0
- Verified compatibility with FAN SDK 4.20.2.
Version 4.20.1.0
- Verified compatibility with FAN SDK 4.20.1.
Version 4.20.0.0
- Verified compatibility with FAN SDK 4.20.0.
Version 4.19.0.0
- Verified compatibility with FAN SDK 4.19.0.
Version 4.18.0.0
- Verified compatibility with FAN SDK 4.18.0.
- Fixed a bug for native ads where AdChoices icon was rendering out of bounds.
Version 4.17.0.0
- Changed the version naming system to [FAN SDK version].[adapter patch version].
- Updated the minimum required Google Mobile Ads SDK to v7.12.0.
- Added support for native ads.
Version 1.4.0
- Requires Google Mobile Ads SDK 7.8.0 or higher.
- Requires FAN SDK 4.13.1 or higher.
- Adapter now uses [kFBAdSizeInterstitial] instead of [kFBAdSizeInterstital].
- Enabled bitcode.
Version 1.2.1
- Fixed a bug where interstitial presented and interstitial leaving application callbacks were not properly invoked.
Version 1.2.0
- Sends callbacks when an ad is presented and dismissed.
Version 1.1.0
- Added support for full width x 250 format when request is
for
kGADAdSizeMediumRectangle
.
Version 1.0.1
- Added support for
kGADAdSizeSmartBanner
.
Version 1.0.0
- Initial release.