Facebook

Introduction

The purpose of this article is to guide publishers who want to use the Fyber FairBid SDK to load and display ads from Facebook Audience Network (FAN) via FairBid Mediation.

This is a six-step process:

  1. Create or login to your  Facebook Audience Network account
  2. Create an app in Facebook Audience Network
  3. Create a placement for your app
  4. Retrieve the parameters from the Facebook dashboard
  5. Insert the Facebook parameters into the Fyber Console
  6. Adding the Facebook Audience Network SDK to your integration

Note

Facebook currently supports the following ad formats:

  • Interstitials
  • Rewarded Videos
  • Banner

Refer to Facebook for updates on supported ad formats. 

Step 1: Create or login to your Facebook Audience Network Account

Follow these steps for creating a Facebook account.

If you are a new user:

  1. Go to Facebook for Developers and register with your Facebook account.

f4fe92f-Screen_Shot_2019-04-01_at_15.18.40.png

  1. Follow the instructions and set your application name.
  2. Click Register.

If you are already registered:

  1. Sign in to your Facebook account
  2. Click My Apps in the top right corner and select your app.

Creating a Business

You can manage your business on Facebook including Facebook advertising and Audience Network monetization. Facebook Manager is a more secure way to manage your Pages and ad accounts. You can see who's working on what and what they have access to see and work on.

  1. Go to Facebook Manager
  2. Click Create Business

aeb2449-Screen_Shot_2019-04-01_at_15.42.07.png

  1. Enter your details and click Next
  2. Enter your business details and click Submit.

f30473f-Screen_Shot_2019-04-01_at_15.43.28.png

Creating a Property

Facebook's Monetization Manager is a platform to help you grow your business with Audience Network. It helps you manage your placements, understand your performance and maximize your revenue.

  1. Go to Monetization Manager, here.
  2. Login with your credentials.
  3. Click the business you just created or create a new business, as described above.

  1. Scroll down and click +Create Property

a456014-Screen_Shot_2019-04-01_at_15.54.56.png

  1. Enter the name of the new property
  2. Click Create Property to continue.

Selecting Your Platform and Display Format

Platforms are the different products you can monetize with Audience Network. Once you have created your property your next step is to add the platform you want to monetize.

3fd0d1b-Screen_Shot_2019-04-01_at_16.02.31.png

  1. Click +Add on the platform you want to work with
  2. Complete the details

  1. Click Submit.

Creating an Ad Space

An Ad Space helps you organize ad placements to reflect what a person is doing when they see an ad in your app. To create an ad placement, you’ll need to create an Ad Space first. You can create up to 4 Ad Spaces per platform.

  1. On the Monetization Manager left tool bar go to Integration >> Properties >> Select a property
  2. Click +Create Ad Space

f6ad675-Screen_Shot_2019-04-01_at_16.25.18.png

  1. Enter a name for the Ad Space

c7a690f-Screen_Shot_2019-04-01_at_16.28.22.png

  1. Upload a file and description of when your ad is to be triggered.
  2. Click Create Ad Space.

Now you have created your Ad Space, you can create ad placements by clicking on the edit icon and Create placement.

  1. Click the menu bar on the window and select Create Placement

d395039-Screen_Shot_2019-04-01_at_16.38.13.png

Step 3: Creating a Placement for your Add

Facebook Audience Network offers different types of ad units. Each ad unit in your app is identified using a unique placement ID.

The Create Placement window is displayed:

fcc25e5-Screen_Shot_2019-04-01_at_16.41.00.png

  1. Enter a Placement Name
  2. Select the display format for your your ad placement.
  3. Scroll down and complete the Price Settings details

1e13c07-Screen_Shot_2019-04-01_at_16.45.17.png

  1. Click Create Placement

Note

An ad placement can only be used by one Ad Space and must match the same platform as the Ad Space.

 

Adding Placements to your App

Once you have click on Create Placement, the details of your placement are displayed:

0da2fa1-Screen_Shot_2019-04-01_at_17.27.43.png

Click Get Code or Copy ID

053b3ea-Screen_Shot_2019-04-01_at_17.29.29.png

Note

Your app cannot receive Audience Network ads until payout information is added and it has been sent for review.

Step 4: Retrieve the parameters from the Facebook dashboard

To enable Facebook to as an Ad Network with Fyber, you must obtain three parameters from your Facebook account and later insert them into the Fyber dashboard.

Set out below are the details of what parameters are required, how and where to obtain them.

The parameters required depend on whether you are configuring the network at the App Level or Placement Level in the Fyber console.

Facebook Parameter Description Fyber Placement / Level
App ID The unique identifier of your app in Facebook Audience Network’s system. Both
System User Access Token This is the most commonly used type of token. This kind of access token is required any time the app calls an API to read, modify or write a specific person’s Facebook data on their behalf. Both
Placement ID The unique identifier of a specific placement in your app in Facebook Audience Network’s system. Placement Level

Alternatively, watch and listen to the video below to find out how to obtain the required parameters:

Retrieving the App ID

To retrieve your App ID, follow these steps:

  1. In the dashboard of your Facebook account, in the left hand menu bar, click App Dashboard

c00a43d-Screen_Shot_2019-04-01_at_17.41.12.png

  1. The App Dashboard is displayed and the App ID appears twice:
eb01d91-Screen_Shot_2019-04-01_at_17.44.44.png 

Retrieving the System User Access Token

To retrieve your System User Access Token, follow Facebook’s Guide.

At Step 3. make sure you check read_insights as well as read_audience_network_insights in Available Scopes.

Retrieving the Placement ID

To retrieve your Placement ID:

  1. Click Audience Network on the left sidebar in the dashboard

8e9c999-Screen_Shot_2019-04-18_at_10.16.31.png

You are asked to navigate to Monetization Manager, click the link:

Under your application review you find a list of your placements, click the one you want to retrieve its Placement ID

Now that you have obtained this information, you can complete the configuration of Facebook's Parameters in your Fyber Account. 

Step 5: Insert the Facebook Parameters into the Fyber Console

To enter the parameters obtained from Facebook and insert them into the Fyber Console, follow these steps.

  1. Sign-in to your Fyber account.
  2. Select your app from the App Management window.

  1. On the App Management page, click Mediated Networks.

  1. Select Facebook from the list

The Facebook Mediation window opens:

  1. Enter the Facebook app credentials and set the Instance name.

Instance name should be distinguishable in case you have multiple Facebook Instances.

Note

If you are configuring the mediated network at app level, fewer credentials may be required.

  1. For each ad format, enter the Instance Name and Placement ID.
  2. Click Save.
  3. To complete the set up, you must associate the network instance that you just created to the relevant Placement set up on the Fyber dashboard. For a detailed guide click here.

You have now successfully integrated Facebook into the console.

Step 6: Adding the Facebook Audience Network SDK to your Integration

To add the Facebook Audience Network SDK go to the Supported Networks page and follow the guide  while selecting the Configuration for Facebook.

Targeting Android P

When targeting Android P and using video ads, you must add an exception rule to 'localhost' found in your apps Network Security Configuration.

  1. Make the Network Security Configuration xml with the code below:
Example of a config file for the 'network security config'
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
   <base-config cleartextTrafficPermitted="true">
       <trust-anchors>
           <certificates src="system" />
       </trust-anchors>
   </base-config>
   <domain-config cleartextTrafficPermitted="true">
       <domain includeSubdomains="true">127.0.0.1</domain>
   </domain-config>
</network-security-config>
  1. Modify your manifest of your app to point to this file.

The following code is an example of how to create this entry:

Manifest Modification (excerpt)
<?xml version="1.0" encoding="utf-8"?>
<manifest ... >
    <application android:networkSecurityConfig="@xml/network_security_config"
                    ... >
        ...
    </application>
</manifest>

More information can be found here.

iOS Frameworks

Add the following frameworks to your project,

  1. libc++
  2. libxml2

Add the libxml2.tbd and libc++.tbd lib to the target by clicking the application target -> Build Phases -> Link Binary With Libraries.