Integrating Facebook Audience Network with 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 via mediation. It covers how to add Facebook ads to an ad unit's mediation configuration, how to set up Ad Network Optimization (ANO),and how to integrate the Facebook Audience Network SDK and adapter into an Unity app.

Supported formats and features

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

Formats
Banners
Interstitials
Rewarded video
Features
Smart banners
Ad Network Optimization (ANO)

Requirements

  • Unity 4 or higher
  • To deploy on Android
    • Android SDK 4.0 (API level 14) or higher
    • Google Play services 9.2 or higher
  • To deploy on iOS
    • Xcode 8.0 or higher
    • iOS Deployment target of 6.0 or higher
    • Minimum required Google Mobile Ads SDK 7.12.0 or higher
  • A working Unity project configured with Google Mobile Ads SDK. See Quick Start for details.

Step 1: Set up Facebook Audience Network

First, sign up and log in to your Facebook developer account. Navigate to My Apps page by clicking on the My Apps button on the top right corner.

Add your app to the Facebook console by clicking the Add a New App button.

Fill out the form and click Create App ID to add your app to Facebook.

Next, in the Facebook dashboard for your app, add Facebook Audience Network to your app by clicking the Add Product under PRODUCTS on the left sidebar and clicking Set Up for Audience Network.

Once your app is added you will be taken to the Audience Network Apps screen. Click Get Started to create an Ad Space.

If your app supports both platforms, you need to create two Ad Spaces, one for each.

To create a new Ad Space click the Create Ad Space button.

Android

iOS

Fill out the form and click Create when done.

Once the Ad Space has been created you will be prompted to create a new Placement. We recommend creating a new placement for mediation with AdMob even if you have one already.

If your app supports both platforms, you need to create two Placements, one for each.

Click the Create Placement button to create a new placement.

For additional instructions on creating an ad placement, select the tab corresponding to your preferred ad format.

Banner

Enter your placement's Name and Steps to Trigger an Ad when prompted.

Select Banner as the Display Format. Toggle the Refresh Rate Handled by Mediation switch to Yes and set your price setting. Double-check that the Status dropdown at the top of the form is set to Enabled, then click Save to create your placement.

Interstitial

Enter your placement's Name and Steps to Trigger an Ad when prompted.

Select Interstitial (App Only) as the Display Format. Set your price setting. Double-check that the Status dropdown at the top of the form is set to Enabled, then click Save to create your placement.

Rewarded

Enter your placement's Name and Steps to Trigger an Ad when prompted.

Select Rewarded Video as the Display Format. Set your price setting. Double-check that the Status dropdown at the top of the form is set to Enabled, then click Save to create your placement.


Android

iOS

In addition to the Placement ID, you'll also need the Facebook App Access Token to set up your ad unit ID for mediation.

To get your App Access Token, navigate to Facebook Access Token Tool under Tools & Support in the Facebook developer dashboard.

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.

If you're deploying your Unity app to both Android and iOS, you need two AdMob ad units, one for each platform.

Next, follow the instructions for either AdMob or AdMob Beta depending on which version of the AdMob UI you're using.

AdMob Android

Navigate to the Monetize tab and select your app from the list of All apps on the left-hand side. A list of ad units associated with your application will be shown.

Click the link in the mediation column for the ad unit you'd like to configure with Facebook.

You will be taken to the ad unit's Mediation page.

Click NEW AD NETWORK.

A list of supported ad networks will be shown.

Select Facebook Audience Network from the list of networks provided and enter the Placement ID obtained in the previous section.

Enter the App Access Token obtained in the previous section. Review and check the Authorization checkbox to set up Ad Network Optimization (ANO) for Facebook Audience Network.

Click Continue at the bottom of the page to complete adding the network. Enter an eCPM value for Facebook Audience Network and click Save.

AdMob iOS

Navigate to the Monetize tab and select your app from the list of All apps on the left-hand side. A list of ad units associated with your application will be shown.

Click the link in the mediation column for the ad unit you'd like to configure with Facebook.

You will be taken to the ad unit's Mediation page.

Click NEW AD NETWORK.

A list of supported ad networks will be shown.

Select Facebook Audience Network from the list of networks provided and enter the Placement ID obtained in the previous section.

Enter the App Access Token obtained in the previous section. Review and check the Authorization checkbox to set up Ad Network Optimization (ANO) for Facebook Audience Network.

Click Continue at the bottom of the page to complete adding the network. Enter an eCPM value for Facebook Audience Network and click Save.

AdMob Beta Android

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

In the Ad Sources card, select Add Ad Network.

Select Facebook Audience Network. Enable the Optimize switch. Enter your App Access Token obtained in the previous section. 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.

AdMob Beta iOS

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

In the Ad Sources card, select Add Ad Network.

Select Facebook Audience Network. Enable the Optimize switch. Enter your App Access Token obtained in the previous section. 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.

Using rewarded video ads

In the settings for your rewarded video ad unit, check the Override reward settings from third-party ad networks when using AdMob mediation so that you provide the same reward to the user no matter which ad network is served.

If you don't override the reward, the Facebook adapter defaults to a reward of type "" (empty string) with value 1. The Facebook SDK does not provide specific reward values for its rewarded video ads.

For more information on setting reward values for AdMob ad units, see Create an ad unit.

Step 3: Import the Facebook Audience Network SDK and adapter

Android

  1. Download the latest version of the Facebook Audience Network SDK for Android and extract the AudienceNetwork.aar (located in the AudienceNetwork/bin folder).
  2. Download the latest Facebook adapter from Bintray. It's located under the Files tab.
  3. Add both the .aar files to the Assets/Plugins/Android directory in your Unity project.

iOS

  1. Download the latest version of the Facebook Audience Network SDK for iOS.
  2. Download the latest version of the Facebook adapter.
  3. Add both the .framework bundles to your Unity project under the Assets/Plugins/iOS directory.

Step 4: Additional code required

No additional code required for Facebook integration.

Step 5: Test your implementation

Facebook ads can be tested by adding the tester's Facebook account as a Tester under the Roles tab on the left-hand side in your Facebook app's dashboard (Administrator or Developer role will also be able to test the ads). The tester will need to log in to the Facebook app on a test device to begin testing. See the Testing Audience Network Implementation guide for more details.

That's it! You now have a working mediation integration with Facebook's Audience Network.

Send feedback about...

AdMob for Unity
AdMob for Unity
Need help? Visit our support page.