Meta Audience Network Integration Guide

Before you start Make sure you have correctly integrated ironSource’s InterstitialRewarded Video or Banner Mediation in your application.

Step 1. Create a Meta Account

  • First Time Setup
    • Go to Meta for Developers and register with your Meta account.
    • Follow the procedure and set your application name.
    • Click ‘Register‘.

Meta for Developers homepage

  • Registered Users
    • Sign into your Meta account.
    • On the right sidebar click on ‘My Apps’.

  • Choose your app

Step 2. Create Business

A Business is the top entity through which you can manage your business on Meta including Meta advertising and Audience Network monetization. To create your business go to Monetization Manager

Step 3. Create Property

A Property in Monetization Manager is a group of products with the same brand. If you have different products for different operating systems, platforms or devices, you can group them into a Property for combined reporting and management in Monetization Manager.

  1. Go to Monetization Manager
  2. Choose your business or create a new business
  3. Click Create Property +

  4. Name your Property based on the brand for the group of apps or websites you’ll be adding to it
  5. Click Create Property

Step 4. Choose your Platform and display format

Choose your platform and display format

Platforms are the various types of products and surfaces you can monetize with Audience Network.
After you created your property your next step is to add the platform you want to monetize:

Step 5. Create Ad Space

Ad Spaces help you organize ad placements in a way that accurately reflects 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. Go to Monetization Manager.
  2. Search for your Property in the search bar using your property name or property ID, then click on Manage Property next to the Property you want to create an Ad Space for.
  3. Select the Platform for where you want to create an Ad Space. If the Platform you want to use does not exist, click on Add Platforms (located on the upper right hand corner) to create it.

  4. Add a video and description of when your ad would be triggered. Click Create Ad Space.

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


Step 6. Create Ad Placement

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

  1. Go to Monetization Manager.
  2. Find and select the Property for which you want to create an ad placement. Click Manage Property on the right.
  3. Scroll down to the Placements section and click Create placement.
    7
    you can also create ad placements by clicking on the edit icon and Create placement as mentioned on Step 5.5 above.
  4. Type in your placement name, select the Ad Space, select the ad Display format and add an optional description.
    8
  5. Choose how you want to optimize your ad placement. The optimization determines how we run the auction for each impression on your app or site:

    9
  6. Click Create placement to finish.
    Note: An ad placement can only be used by one Ad Space and needs to match the same platform as the Ad Space. 

    Add Placements to Your App

    1. Go to Monetization Manager.
    2. Click on Managed property
    3. Click on Ad Spaces then scroll down to Placements, or filter to find the placement that you need
    4. In the Placement ID column click Get Code or Copy ID
      9
    Note: Your app won’t be able to receive Audience Network ads until payout information has been added and it was sent for review.

    Step 7. Activate Meta Audience Network on the ironSource SDK Network Module

    There are 3 pieces of Data from the Meta Audience Network account which need to be inserted into your ironSource Network Setup Module in order for Meta Audience Network to work correctly in connection with ironSource:

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

    Once you obtain this information, you must configure Meta Audience Network’s Parameters in your ironSource Account. By adding the above information correctly, you will be able to take full advantage of Meta’s Interstitial or Banner ad inventory and reporting data on ironSource’s Mediation platform.

    1. App ID
      1. Go to Monetization Manager.
      2. Click on Managed property
      3. Click on Ad Spaces then scroll down to Placements, or filter to find the placement that you need
      4. In the Placement ID column click Get Code
      5. Copy the first part of the placement ID (until the underscore)
        aaa
    2. System User Access Token
      To retrieve your System User Access Token, please follow Meta’s Guide. On Step 3. make sure you to check  read_audience_network_insights in Available Scopes.
    3. Placement ID
      1. Go to Monetization Manager.
      2. Click on Managed property
      3. Click on Ad Spaces then scroll down to Placements, or filter to find the placement that you need
      4. In the Placement ID column click Get Code
      5. Copy the placement ID
        aaa

    Configure Meta Audience Network‘s Parameters into ironSource Account

    • Once you have all these parameters, log in to your ironSource account and go to ‘Monetize‘ ➣ ‘Setup‘ ➣ ‘SDK Networks‘.
      SDK Networks Setup
    • Select Meta Audience Network from the list of Available Ad Networks and click on ‘Activate’.
      Note: To run Mediation with Meta Audience Network, you must have an active Meta Audience Network Account. When you select Meta Audience Network as a network, you will see the below pop-up. If you have an active Meta account, simply click activate and Save. If you do not have an active Meta account, you must register at Meta Audience Network and follow this documentation from Step 1.
      Save account settings
    • Select the app on which you’d like to run ironSource‘s Interstitial, Rewarded Video or Banner Mediation with Meta Audience Network.Select app - SDK Network Settings
    • Select Meta Audience Network from the Setup list of Ad Networks, click on the Define icon and insert the App ID, Placement ID and System User Access Token in the relevant fields.Save account settings
    • Then click ‘Save’, you will then see Meta Audience Network as Active for the ad unit of choice on your Mediation Dashboard.

      Networks
    • Verify your integration with the Reporting API; this column will check your integration through the Reporting API and return three possible responses: Verified, Failed and No Response. Double check your integration and the information you entered above; then click ‘Retry‘ until you see ‘Verified’.

    Step 8. Add the Meta Audience Network Adapter to Your Build

    ironSource supports both Gradle dependencies and manual download mechanisms.

    Gradle:

    1. Make sure the following Maven URL exist in your build.gradle script of your app module.
      repositories {
      maven {
               url  "https://android-sdk.is.com/"
            }
      }
    2. Add the adapter’s Maven name to your build.gradle script of your app module.
      implementation 'com.ironsource.adapters:facebookadapter:4.3.34'
      implementation 'com.facebook.android:audience-network-sdk:6.8.0'
      

     Manual download:

    1. Download the Meta Audience Network Adapter and .AAR files:
      Add the Meta Audience Network Adapter to your build. You can find the latest Meta Audience Network Adapter and SDK here.
    2. Add the Meta Audience Network Adapter to your project:
      After you download the Adapter; drop the Meta Audience NetworkAdapter jar into the libs folder in your Android Project.
      Supersonic Drop Jar into Libs
    3. Add the Meta Audience Network .AAR files to your project: 
      1. If using Eclipse: Import the .AAR files as a library project.
      2. If using Android Studio, download the Meta .AAR files and add as a dependencies to your own module. Go to File  New  New Module  Import .AAR and navigate to the location where the FAN.AAR files have been downloaded.
        android-studio-aar-integration
    4. Make sure you add the following to your Gradle build file under the dependencies section:
      implementation 'com.ironsource.adapters:facebookadapter:4.3.34'
      implementation 'com.facebook.android:audience-network-sdk:6.8.0'
      

    For Proguard Users Only

    If you are using ProGuard with the Meta adapter, you must add the following code to your ProGuard file:

    -dontwarn com.facebook.ads.internal.**
    -keeppackagenames com.facebook.*
    -keep public class com.facebook.ads.** {*;}
    -keep public class com.facebook.ads.**
    { public protected *; }

    Step 9. Update AndroidManifest.xml

    As of Meta Android adapter version 4.3.16+ (Android SDK Version 6.17.0), Meta adapter will be released as AAR. Only if you intend to keep your Jar integration, please add the manifest.


    Manifest Permissions:

    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name=“android.permission.ACCESS_NETWORK_STATE” />

    Manifest Activities:
    Add the following activities inside the <application> tag in your manifestAdditions:

    <activity
        android:name="com.facebook.ads.AudienceNetworkActivity"
        android:hardwareAccelerated="true"
        android:configChanges="keyboardHidden|orientation|screenSize" />

    Step 10. Network Security Settings

    Meta’s SDK requires clear text traffic permission to localhost. In Android P devices this permission is blocked by default. You can permit this traffic by adding

    <?xml version="1.0" encoding="utf-8"?>
    <network-security-config>
        ...
        <domain-config cleartextTrafficPermitted="true">
            <domain includeSubdomains="true">127.0.0.1</domain>
        </domain-config>
        ...
    </network-security-config>

    to network_security_config.xml.  Then in your application manifest, add the configuration to your application attribute as follows:

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

    Read more about here.

    Step 11. Meta Additional Settings

    CacheFlag Configuration 

    ironSource enables you to report Meta CacheFlag values for interstitial ads, starting from Meta adapter version 4.3.15+.

    Define the CacheFlag before the Init to set a single value, using “Meta_IS_CacheFlag” setting:

     IronSource.setMetaData("Facebook_IS_CacheFlag","IMAGE");

    The supported values are as follows: ICON, IMAGE, NONE, VIDEO or ALL to apply all values.

    More information about Meta CacheFlag values can be found here.

    CCPA Support 

    If you are using Meta adapter 4.3.18+, make sure to follow Meta Audience Network instructions, as described here. Please note that setting FAN Limited Data Use flag, should be done before initializing ironSource Mediation. 

    Verify Your Ad Network Integration

    The ironSource SDK provides an easy way to verify that your mediation integration was completed successfully. To verify your ironSource and additional Ad Networks integration, follow this document.

    Note: if you are using Meta Audience Network’s server-to-server callbacks and are leveraging the DynamicUserID parameter to verify AdRewarded events, you will see this parameter reflected in their server-side callbacks. In addition, you can also see this parameter in the ironSource server-to-server callbacks.

    Done!
    You are now all set to deliver Meta Audience Network Ads through the ironSource Mediation platform!


    What’s Next?
    To leverage additional ad networks through ironSource Mediation, integrate the adapters and follow our integration guides.