<br />

> [!NOTE]
> **Note:** Facebook Audience Network is now Meta Audience Network. See [Meta's
> announcement](https://about.fb.com/news/2021/10/facebook-company-is-now-meta/) for more information.

This guide shows you how to use Google Mobile Ads Flutter Plugin to load and display
ads from Meta Audience Network using
[mediation](https://developers.google.com/ad-manager/mobile-ads-sdk/flutter/mediation.md.txt), covering bidding
integrations. It covers how to add
Meta Audience Network to an ad unit's
mediation configuration, and how to integrate the
Meta Audience Network and
adapter into a Flutter app.

## Supported integrations and ad formats

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

| Integration ||
|---|---|
| Bidding | Yes |
| Waterfall [^1^](https://developers.google.com/ad-manager/mobile-ads-sdk/flutter/mediation/meta.md.txt#bidding-only-footnote) |   |
| App Open |   |
| Banner | Yes |
| Interstitial | Yes |
| Rewarded | Yes |
| Rewarded Interstitial | Yes |
| Native | Yes |

^1^
Meta Audience Network
became
[bidding only](https://www.facebook.com/audiencenetwork/resources/blog/audience-network-to-become-bidding-only-beginning-with-ios-in-2021)
in 2021.

## Prerequisites

Before you continue, verify the following:

- Latest Google Mobile Ads Flutter Plugin version.
- Flutter framework version 3.7.0 or later.
- To deploy on Android
  - Android API level 24 or later.
- To deploy on iOS
  - iOS deployment target of 15.0 or later.
  - The latest Meta Audience Network SDK usually requires the latest version of Xcode.
- A working Flutter project configured with Google Mobile Ads Flutter Plugin. See [Set up Google Mobile Ads Flutter Plugin](https://developers.google.com/ad-manager/mobile-ads-sdk/flutter/quick-start.md.txt) for details.

- [Set up mediation](https://developers.google.com/ad-manager/mobile-ads-sdk/flutter/mediation.md.txt).

## Step 1: Set up configurations in Meta Audience Network UI

- Sign up and log in to the [Business Manager Start
  page](https://business.facebook.com/pub/start).
- Click **Get started** then **Create new account**.
- ![](https://developers.google.com/static/admob/images/mediation/facebook/create_business.png)
- Fill out the required fields with your business details and click **Next**.
- ![](https://developers.google.com/static/admob/images/mediation/facebook/business_details.png)

### Create a property

- After you've filled out the required information, you're prompted to create a property for your app. Enter the desired name of the property for your app and click **Next**.
- ![](https://developers.google.com/static/admob/images/mediation/facebook/add_property.png)
- Next, select your platform to monetize.
- ![](https://developers.google.com/static/admob/images/mediation/facebook/select_platform.png)
- Add your app details and click **Next**.

### Android

![](https://developers.google.com/static/admob/images/mediation/facebook/app_details_Android.png)

### iOS

![](https://developers.google.com/static/admob/images/mediation/facebook/app_details_iOS.png)
- Set up your payment account by clicking **Add a new payment account** . You will be redirected to a new page to enter your payment information. Fill out the necessary details, then click **Next**.
- ![](https://developers.google.com/static/admob/images/mediation/facebook/payment_account.png)
- Select **Google Ad Manager** as the **Mediation platform** , then click **Create placement**.
- ![](https://developers.google.com/static/admob/images/mediation/facebook/sdk_integration-GAM.png)
- Select a format, fill out the form and click **Create**.

> [!NOTE]
> **Note:** If you use anchored adaptive banners or inline adaptive banners with a maximum height of 249 or lower, select the **Banner** format. If you integrate inline adaptive banners using a maximum height of 250 or higher, select the **Medium rectangle** format.

- ![](https://developers.google.com/static/admob/images/mediation/facebook/create_placement.png)
- Take note of the **Placement ID**.
- ![](https://developers.google.com/static/admob/images/mediation/facebook/format_placement_id.png)
- Click **Done**.

### Update your app-ads.txt

- [Authorized Sellers for Apps app-ads.txt](https://iabtechlab.com/wp-content/uploads/2019/03/app-ads.txt-v1.0-final-.pdf) is an IAB Tech Lab initiative that helps ensure your app ad inventory is only sold through channels you've identified as authorized. To prevent a significant loss in ad revenue, you'll need to implement an `app-ads.txt` file. If you haven't done so already, [create an app-ads.txt file for Ad Manager](https://support.google.com/admanager/answer/7544382).
- To implement `app-ads.txt` for Meta Audience Network, see [Identifying Authorized Sellers with app-ads.txt](https://developers.facebook.com/docs/audience-network/optimization/best-practices/authorized-sellers-app-ads/).

### Turn on test mode

- See the [Testing Audience Network Implementation
  guide](https://developers.facebook.com/docs/audience-network/testing) for detailed instructions on how to enable Meta Audience Network test ads.

## Step 2: Set up Meta Audience Network demand in Ad Manager UI

### Configure mediation settings for your ad unit

### Android

For instructions, see step 2 in the guide for

[Android](https://developers.google.com/ad-manager/mobile-ads-sdk/android/mediation/meta.md.txt#step-2).

### iOS

For instructions, see step 2 in the guide for

[iOS](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/mediation/meta.md.txt#step-2).

### Add Meta to GDPR and US state regulations ad partners list

- Follow the steps in [European regulations settings](https://support.google.com/admanager/answer/10113006#adding_ad_partners_to_published_gdpr_messages) and [US state regulations settings](https://support.google.com/admanager/answer/14117973) to add **Meta** to the European and US state regulations ad partners list in the Ad Manager UI.

## Step 3: Import the Meta Audience Network SDK and adapter

> [!NOTE]
> **Note:** Failure to integrate the compatible Meta Audience Network and Google Mobile Ads Flutter Plugin versions might lead to build issues.

### Integration through pub.dev

- Add the following dependency with the latest versions of the Meta Audience Network SDK and adapter in your package's `pubspec.yaml` file:

```yaml
dependencies:
  gma_mediation_meta: ^1.7.1
```

### Manual Integration

- Download the latest version of Google Mobile Ads mediation plugin for [Meta Audience Network](https://pub.dev/packages/gma_mediation_meta/versions), extract the downloaded file, and add the extracted plugin folder (and its contents) to your Flutter project. Then, reference the plugin in your `pubspec.yaml` file by adding the following dependency:

```yaml
dependencies:
  gma_mediation_meta:
    path: path/to/local/package
```

## Step 4: Implement privacy settings on Meta Audience Network SDK

### EU consent and GDPR

- To [comply with
  the Google EU User Consent Policy](https://www.google.com/about/company/consentstaging.html), you must make certain disclosures to your users in the European Economic Area (EEA), the UK, and Switzerland, and obtain their consent for the use of cookies or other local storage where legally required, and for the collection, sharing, and use of personal data for ads personalization. This policy reflects the requirements of the EU ePrivacy Directive and the General Data Protection Regulation (GDPR). You are responsible for verifying that consent is propagated to each ad source in your mediation chain.
- Review Meta's [guidance](https://www.facebook.com/business/gdpr) for information about GDPR and Meta advertising.

### US states privacy laws

- [US states privacy laws](https://support.google.com/admanager/answer/9561023) require giving users the right to opt out of the "sale" of their "personal information" (as the law defines those terms), with the opt-out offered through a prominent "Do Not Sell My Personal Information" link on the "selling" party's homepage. The [US states privacy
  laws compliance guide](https://developers.google.com/ad-manager/mobile-ads-sdk/flutter/privacy/us-states) offers the ability to enable [restricted data processing](https://privacy.google.com/businesses/rdp/) 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.
- For users in California, review Meta's [data processing
  options](https://developers.facebook.com/docs/marketing-apis/data-processing-options).

## Step 5: Add required code

### Android

No additional code required for
Meta Audience Network integration.

### iOS

### SKAdNetwork integration

Follow [Meta Audience Network's
documentation](https://developers.facebook.com/docs/audience-network/guides/SKAdNetwork)
to add the SKAdNetwork identifiers to your project's `Info.plist` file.

### Advertising tracking enabled

If you are building for iOS 14 or higher, check
Meta Audience Network's
instructions on how to set their [Advertising Tracking
Flag](https://developers.facebook.com/docs/audience-network/setting-up/platform-setup/ios/advertising-tracking-enabled#unity).

## Step 6: Test your implementation

### Enable test ads

- Make sure you [register your test device](https://developers.google.com/ad-manager/mobile-ads-sdk/flutter/test-ads.md.txt#enable_test_devices) for Ad Manager and [enable test mode](https://developers.google.com/ad-manager/mobile-ads-sdk/flutter/mediation/meta.md.txt#turn-on-test-mode) in Meta Audience Network UI.

> [!IMPORTANT]
> **Key Point:** When testing, ensure that you have the Facebook app installed on the test device and be logged in with a valid Facebook login. See [Meta's documentation](https://developers.facebook.com/docs/audience-network/setting-up/testing/platform#test-mobile-apps) for more details.

> [!IMPORTANT]
> **Important:** Disable test mode for Ad Manager and Meta Audience Network before releasing your app.

### Verify test ads

- To verify that you are receiving test ads from Meta Audience Network, enable [single ad source testing](https://developers.google.com/ad-manager/mobile-ads-sdk/flutter/ad-inspector.md.txt#single_ad_source_testing) in ad inspector using the **Meta Audience Network (Bidding)** ad source(s).

## Optional steps

### Caching on Android 9

### Android

Starting with Android 9 (API level 28), [cleartext support is disabled by
default](https://developer.android.com/training/articles/security-config#CleartextTrafficPermitted),
which will affect the functionality of media caching of the
Meta Audience Network
SDK and could affect user experience and ads revenue. Follow [Meta's
documentation](https://developers.facebook.com/docs/audience-network/android-network-security-config/)
to update the network security configuration in your app.

### iOS

Not applicable for iOS integrations.

## Error codes

- If the adapter fails to receive an ad from Audience Network, you can check the underlying error from the ad response using [`ResponseInfo`](https://developers.google.com/ad-manager/mobile-ads-sdk/flutter/response-info.md.txt) under the following classes:

### Android

```java
com.google.ads.mediation.facebook.FacebookAdapter
com.google.ads.mediation.facebook.FacebookMediationAdapter
```

### iOS

```objective-c
GADMAdapterFacebook
GADMediationAdapterFacebook
```
- Here are the codes and accompanying messages thrown by the Meta Audience Network adapter when an ad fails to load:

### Android

| Error code | Reason |
|---|---|
| 101 | Invalid server parameters (e.g. missing Placement ID). |
| 102 | The requested ad size does not match a Meta Audience Network supported banner size. |
| 103 | The publisher must request ads with an `Activity` context. |
| 104 | The Meta Audience Network SDK failed to initialize. |
| 105 | The publisher did not request for Unified native ads. |
| 106 | The native ad loaded is a different object than the one expected. |
| 107 | The `Context` object used is invalid. |
| 108 | The loaded ad is missing the required native ad assets. |
| 109 | Failed to create a native ad from the bid payload. |
| 110 | The Meta Audience Network SDK failed to present their interstitial/rewarded ad. |
| 111 | Exception thrown when creating a Meta Audience Network `AdView` object. |
| 1000-9999 | The Meta Audience Network returned an SDK-specific error. See Meta Audience Network's [documentation](https://developers.facebook.com/docs/audience-network/guides/test/checklist-errors) for more details. |

### iOS

| Error code | Reason |
|---|---|
| 101 | Invalid server parameters (e.g. missing Placement ID). |
| 102 | The requested ad size does not match a Meta Audience Network supported banner size. |
| 103 | The Meta Audience Network ad object failed to initialize. |
| 104 | The Meta Audience Network SDK failed to present their interstitial/rewarded ad. |
| 105 | Root view controller of the banner ad is `nil`. |
| 106 | The Meta Audience Network SDK failed to initialize. |
| 1000-9999 | The Meta Audience Network returned an SDK-specific error. See Meta Audience Network's [documentation](https://developers.facebook.com/docs/audience-network/guides/test/checklist-errors) for more details. |

## Meta Audience Network Flutter Mediation Adapter Changelog

#### Version 1.7.2 (In progress)

#### Version 1.7.1

  - Supports [Meta Audience Network Android adapter version 6.22.0.1](https://github.com/googleads/googleads-mobile-android-mediation/blob/main/ThirdPartyAdapters/meta/CHANGELOG.md#version-62201).
  - Supports [Meta Audience Network iOS adapter version 6.22.0.0](https://github.com/googleads/googleads-mobile-ios-mediation/blob/main/adapters/Meta/CHANGELOG.md#version-62200).
  - Built and tested with the Google Mobile Ads Flutter Plugin version 9.1.0.

#### Version 1.7.0

  - Updated to support Google Mobile Ads Flutter Plugin version 9.1.0.
  - Added Swift Package Manager support.
  - Supports [Meta Audience Network Android adapter version 6.22.0.0](https://github.com/googleads/googleads-mobile-android-mediation/blob/main/ThirdPartyAdapters/meta/CHANGELOG.md#version-62200).
  - Supports [Meta Audience Network iOS adapter version 6.22.0.0](https://github.com/googleads/googleads-mobile-ios-mediation/blob/main/adapters/Meta/CHANGELOG.md#version-62200).
  - Built and tested with the Google Mobile Ads Flutter Plugin version 9.1.0.

#### Version 1.6.0

  - Supports [Meta Audience Network Android adapter version 6.22.0.0](https://github.com/googleads/googleads-mobile-android-mediation/blob/main/ThirdPartyAdapters/meta/CHANGELOG.md#version-62200).
  - Supports [Meta Audience Network iOS adapter version 6.21.1.1](https://github.com/googleads/googleads-mobile-ios-mediation/blob/main/adapters/Meta/CHANGELOG.md#version-621111).
  - Built and tested with the Google Mobile Ads Flutter Plugin version 9.0.0.

#### Version 1.5.4

  - Supports [Meta Audience Network Android adapter version 6.21.0.4](https://github.com/googleads/googleads-mobile-android-mediation/blob/main/ThirdPartyAdapters/meta/CHANGELOG.md#version-62104).
  - Supports [Meta Audience Network iOS adapter version 6.21.1.1](https://github.com/googleads/googleads-mobile-ios-mediation/blob/main/adapters/Meta/CHANGELOG.md#version-62111).
  - Built and tested with the Google Mobile Ads Flutter Plugin version 9.0.0.

#### Version 1.5.3

  - Updated to support Google Mobile Ads Flutter Plugin version 9.0.0
  - Supports [Meta Audience Network Android adapter version 6.21.0.3](https://github.com/googleads/googleads-mobile-android-mediation/blob/main/ThirdPartyAdapters/meta/CHANGELOG.md#version-62103).
  - Supports [Meta Audience Network iOS adapter version 6.21.1.1](https://github.com/googleads/googleads-mobile-ios-mediation/blob/main/adapters/Meta/CHANGELOG.md#version-62111).
  - Built and tested with the Google Mobile Ads Flutter Plugin version 9.0.0.

#### Version 1.5.2

  - Updated minimum Flutter version to 3.38.1
  - Updated to support Google Mobile Ads Flutter Plugin version 8.0.0
  - Supports [Meta Audience Network Android adapter version 6.21.0.2](https://github.com/googleads/googleads-mobile-android-mediation/blob/main/ThirdPartyAdapters/meta/CHANGELOG.md#version-62102).
  - Supports [Meta Audience Network iOS adapter version 6.21.1.0](https://github.com/googleads/googleads-mobile-ios-mediation/blob/main/adapters/Meta/CHANGELOG.md#version-62110).
  - Built and tested with the Google Mobile Ads Flutter Plugin version 8.0.0.

#### Version 1.5.1

  - Updated minimum Flutter version to 3.35.1
  - Updated to support Google Mobile Ads Flutter Plugin version 7.0.0
  - Supports [Meta Audience Network Android adapter version 6.21.0.1](https://github.com/googleads/googleads-mobile-android-mediation/blob/main/ThirdPartyAdapters/meta/CHANGELOG.md#version-62101).
  - Supports [Meta Audience Network iOS adapter version 6.21.0.1](https://github.com/googleads/googleads-mobile-ios-mediation/blob/main/adapters/Meta/CHANGELOG.md#version-62101).
  - Built and tested with the Google Mobile Ads Flutter Plugin version 7.0.0.

#### Version 1.5.0

  - Supports [Meta Audience Network Android adapter version 6.21.0.0](https://github.com/googleads/googleads-mobile-android-mediation/blob/main/ThirdPartyAdapters/meta/CHANGELOG.md#version-62100).
  - Supports [Meta Audience Network iOS adapter version 6.21.0.0](https://github.com/googleads/googleads-mobile-ios-mediation/blob/main/adapters/Meta/CHANGELOG.md#version-62100).
  - Built and tested with the Google Mobile Ads Flutter Plugin version 6.0.0.

#### Version 1.4.3

  - Supports [Meta Audience Network Android adapter version 6.20.0.2](https://github.com/googleads/googleads-mobile-android-mediation/blob/main/ThirdPartyAdapters/meta/CHANGELOG.md#version-62002).
  - Supports [Meta Audience Network iOS adapter version 6.20.1.0](https://github.com/googleads/googleads-mobile-ios-mediation/blob/main/adapters/Meta/CHANGELOG.md#version-62010).
  - Built and tested with the Google Mobile Ads Flutter Plugin version 6.0.0.

#### Version 1.4.2

  - Supports [Meta Audience Network Android adapter version 6.20.0.1](https://github.com/googleads/googleads-mobile-android-mediation/blob/main/ThirdPartyAdapters/meta/CHANGELOG.md#version-62001).
  - Supports [Meta Audience Network iOS adapter version 6.20.1.0](https://github.com/googleads/googleads-mobile-ios-mediation/blob/main/adapters/Meta/CHANGELOG.md#version-62010).
  - Built and tested with the Google Mobile Ads Flutter Plugin version 6.0.0.

#### Version 1.4.1

  - Supports [Meta Audience Network Android adapter version 6.20.0.0](https://github.com/googleads/googleads-mobile-android-mediation/blob/main/ThirdPartyAdapters/meta/CHANGELOG.md#version-62000).
  - Supports [Meta Audience Network iOS adapter version 6.20.1.0](https://github.com/googleads/googleads-mobile-ios-mediation/blob/main/adapters/Meta/CHANGELOG.md#version-62010).
  - Built and tested with the Google Mobile Ads Flutter Plugin version 6.0.0.

#### Version 1.4.0

  - Supports [Meta Audience Network Android adapter version 6.20.0.0](https://github.com/googleads/googleads-mobile-android-mediation/blob/main/ThirdPartyAdapters/meta/CHANGELOG.md#version-62000).
  - Supports [Meta Audience Network iOS adapter version 6.20.0.0](https://github.com/googleads/googleads-mobile-ios-mediation/blob/main/adapters/Meta/CHANGELOG.md#version-62000).
  - Built and tested with the Google Mobile Ads Flutter Plugin version 6.0.0.

#### Version 1.3.0

  - Supports [Meta Audience Network Android adapter version 6.20.0.0](https://github.com/googleads/googleads-mobile-android-mediation/blob/main/ThirdPartyAdapters/meta/CHANGELOG.md#version-62000).
  - Supports [Meta Audience Network iOS adapter version 6.17.1.0](https://github.com/googleads/googleads-mobile-ios-mediation/blob/main/adapters/Meta/CHANGELOG.md#version-61710).
  - Built and tested with the Google Mobile Ads Flutter Plugin version 6.0.0.

#### Version 1.2.0

  - Supports [Meta Audience Network Android adapter version 6.19.0.1](https://github.com/googleads/googleads-mobile-android-mediation/blob/main/ThirdPartyAdapters/meta/CHANGELOG.md#version-61901).
  - Supports [Meta Audience Network iOS adapter version 6.17.0.0](https://github.com/googleads/googleads-mobile-ios-mediation/blob/main/adapters/Meta/CHANGELOG.md#version-61700).
  - Built and tested with the Google Mobile Ads Flutter Plugin version 6.0.0.

#### Version 1.1.0

  - iOS plugin is now a static framework.
  - Supports [Meta Audience Network Android adapter version 6.18.0.0](https://github.com/googleads/googleads-mobile-android-mediation/blob/main/ThirdPartyAdapters/meta/CHANGELOG.md#version-61800).
  - Supports [Meta Audience Network iOS adapter version 6.16.0.0](https://github.com/googleads/googleads-mobile-ios-mediation/blob/main/adapters/Meta/CHANGELOG.md#version-61600).
  - Built and tested with the Google Mobile Ads Flutter Plugin version 5.3.1.

#### Version 1.0.1

  - Added dart class to allow correct compatibility analysis with host platforms
  - Supports [Meta Audience Network Android adapter version 6.17.0.0](https://github.com/googleads/googleads-mobile-android-mediation/blob/main/ThirdPartyAdapters/meta/CHANGELOG.md#version-61700).
  - Supports [Meta Audience Network iOS adapter version 6.15.0.0](https://github.com/googleads/googleads-mobile-ios-mediation/blob/main/adapters/Meta/CHANGELOG.md#version-61500).
  - Built and tested with the Google Mobile Ads Flutter Plugin version 5.1.0.

#### Version 1.0.0

  - Initial release.
  - Supports [Meta Audience Network Android adapter version 6.17.0.0](https://github.com/googleads/googleads-mobile-android-mediation/blob/main/ThirdPartyAdapters/meta/CHANGELOG.md#version-61700).
  - Supports [Meta Audience Network iOS adapter version 6.15.0.0](https://github.com/googleads/googleads-mobile-ios-mediation/blob/main/adapters/Meta/CHANGELOG.md#version-61500).
  - Built and tested with the Google Mobile Ads Flutter Plugin version 5.0.0.