Integrating Facebook Audience Network with Open Bidding Mediation

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 through Open Bidding. It covers how to add Facebook ads to an ad unit's Open Bidding configuration and how to integrate the Facebook Audience Network SDK and adapter into an iOS app.

Supported ad formats and features

The Ad Manager mediation adapter for the Facebook Audience Network has the following capabilities:

Formats
Banners
Interstitials
Rewarded Video
Rewarded Interstitial
Native Advanced
Features
Smart Banners
Native Video

Requirements

  • iOS deployment target of 9.0 or higher

  • The latest Facebook Audience Network SDK usually requires the latest version of Xcode

  • Facebook Audience Network adapter 5.10.0.0 or higher (latest version recommended)

  • 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.

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'll be prompted to create an ad placement for your application. Select a format, fill out the form and click Next.

The next step presents an overview of the placement you created. Check the This app is using mediation checkbox and take note of the Placement ID, which will be used when setting up your ad unit ID.

Step 2: Configure mediation settings for your Ad Manager ad unit

Sign in to your Ad Manager account. Navigate to Delivery > Yield groups and click the New yield group button.

Enter a unique Name for your yield group, set the Status to Active, select your Ad Format, and set the Inventory type to Mobile App. Under the Targeting > Inventory section, select the Ad Unit ID to which you want to add mediation.

Next, click the Add yield partner button.

If you already have a Yield partner for the Facebook Audience Network, you can simply select it. Otherwise, select Create a new yield partner.

Select Facebook as the Ad network and enter a unique Name. Enable Mediation, Open Bidding, and click Save when done.

Once the Yield partner is selected, choose Open Bidding as the Integration type, and Active as the Status. Click Save at the bottom of the page when done.

Navigate to Inventory > Mobile apps and select New mobile app.

Fill out the form to search for the app you want to add. After adding an app, click Save at the bottom of the page.

Create an ad unit mapping

For Open Bidding, you need to configure an ad unit mapping to associate an ad unit and an application with a particular Facebook Open Bidding configuration. To add a new ad unit mapping, navigate to Delivery > Yield partners and click the yield partner you created above.

Click on the Ad Unit Mapping tab and then click on New ad unit mapping.

Select Specific ad unit, the same ad unit your targeted to your yield group, your Ad Format, Mobile app as the Inventory type, and your Mobile Application. Then, enter your unique Placement ID.

Click Save at the bottom of the page when done.

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 Override reward settings from third-party ad networks when using mediation 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

  • Add the following line to your project's Podfile:

    pod 'GoogleMobileAdsMediationFacebook'
    
  • From the command line run:

    pod install --repo-update

Manual integration

Verify your adapter and SDK versions

To log the adapter and SDK versions, use the following code snippet:

Class<GADMediationAdapter> adapterClass = NSClassFromString(@"GADMediationAdapterFacebook");
if (adapterClass != nil) {
  GADVersionNumber adapterVersion = [adapterClass version];
  GADVersionNumber sdkVersion = [adapterClass adSDKVersion];
  NSLog(@"Adapter version: %ld.%ld.%ld.%ld",
        adapterVersion.majorVersion,
        adapterVersion.minorVersion,
        adapterVersion.patchVersion / 100,
        adapterVersion.patchVersion % 100);
  NSLog(@"SDK version: %ld.%ld.%ld",
        sdkVersion.majorVersion,
        sdkVersion.minorVersion,
        sdkVersion.patchVersion);
}

Logging the adapter version in Swift is not possible since the dynamic runtime feature does not exist in Swift, making it infeasible to dynamically create the class from the class name. If this is needed in Swift, it needs to be written in Objective-C and imported using a bridging header.

Step 4: Additional Code Required

No Additional code required for Facebook Audience Network integration.

Optional Steps

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.

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

If your app renders native ads without a GADMediaView asset, Facebook Audience network requires that you implement their native banner ad format. The Facebook adapter version 5.7.1.1 and higher officially supports requesting of Native Banner ad formats for Open Bidding.

Ad rendering

The Facebook adapter returns its native ads as UnifiedNativeAd objects. It populates the following fields 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
Open Bidding 1 px of native ad on screen + asset rendering requirements Facebook Audience Network SDK callback

For Open Bidding impressions, Facebook Audience Network has specific asset rendering requirements in order for an impression to be considered valid, depending on whether you selected the Native or Native Banner format when setting up Facebook Audience Network.

Facebook native format Required asset Required rendering class
Native Media View GADMediaView
Native Banner App icon UIImageView