<br />

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

## Supported integrations and ad formats

The AdMob mediation adapter for
Moloco Ads SDK has the following
capabilities:

| Integration ||
|---|---|
| Bidding | Yes |
| Waterfall |   |
| App Open |   |
| Banner | Yes |
| Interstitial | Yes |
| Rewarded | Yes |
| Rewarded Interstitial |   |
| Native |   |

## 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 13.0 or later.
- A working Flutter project configured with Google Mobile Ads Flutter Plugin. See [Set up
  Google Mobile Ads Flutter Plugin](https://developers.google.com/admob/flutter/quick-start) for details.

- [Set up AdMob Mediation](https://developers.google.com/admob/flutter/mediation.md.txt).

## Step 1: Set up configurations in Moloco Ads SDK UI

- [Log in](https://publisher.moloco.cloud/login) to the Moloco Publisher Portal.
- Navigate to **Overview** \> **Apps** tab, then click the **Add App** button to create a new app.
![](https://developers.google.com/static/admob/images/mediation/moloco/new_app.png)
- Select the **OS** and **Privacy Settings** for your app, fill out the rest of the form, and then click **Create**.

### Android

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

### iOS

![](https://developers.google.com/static/admob/images/mediation/moloco/new_app_details_iOS.png)
- Once your app is created, select it from the **Apps** tab to view the details and take note of the **App Key**.

### Android

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

### iOS

![](https://developers.google.com/static/admob/images/mediation/moloco/app_details_iOS.png)
- Navigate to the **Overview** \> **Ad Units** tab, select the app from the drop-down menu, and then click **New Ad Unit**.
![](https://developers.google.com/static/admob/images/mediation/moloco/new_ad_unit.png)
- Select **In-app bidding** as the **Auction method** and fill out the rest of the form. Then, click **Create**.
![](https://developers.google.com/static/admob/images/mediation/moloco/new_ad_unit_form.png)
- Navigate to your newly created ad unit under the **Ad Units** tab to view its details. Take note of the **Ad Unit ID**.
![](https://developers.google.com/static/admob/images/mediation/moloco/ad_unit_details.png)

## Step 2: Set up Moloco Ads SDK demand in AdMob UI

### Configure mediation settings for your ad unit

### Android

For instructions, see step 2 in the guide for

[Android](https://developers.google.com/admob/android/mediation/moloco.md.txt#step-2).

### iOS

For instructions, see step 2 in the guide for

[iOS](https://developers.google.com/admob/ios/mediation/moloco.md.txt#step-2).

### Add Moloco Ads to GDPR and US state regulations ad partners list

> [!IMPORTANT]
> **Important:** Verify that you have **Account Management** permission to complete the configuration for EU Consent and GDPR, US State regulations, and User Messaging Platform. See [Manage user access to your
> account](https://support.google.com/admob/answer/2784628) for details.

- Follow the steps in [European regulations settings](https://support.google.com/admob/answer/10113004#adding_ad_partners_to_published_gdpr_messages) and [US state regulations settings](https://support.google.com/admob/answer/14125907) to add **Moloco Ads** to the European and US state regulations ad partners list in the AdMob UI.

## Step 3: Import the Moloco Ads SDK SDK and adapter

> [!NOTE]
> **Note:** Failure to integrate the compatible Moloco Ads SDK 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 Moloco Ads SDK SDK and adapter in your package's `pubspec.yaml` file:

```yaml
dependencies:
  gma_mediation_moloco: ^3.8.0
```

### Manual Integration

- Download the latest version of Google Mobile Ads mediation plugin for [Moloco Ads SDK](https://pub.dev/packages/gma_mediation_moloco/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_moloco:
    path: path/to/local/package
```

## Step 4: Implement privacy settings on Moloco 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.
- Moloco Ads SDK Flutter adapter version 1.0.0 and later supports passing GDPR consent signals from consent management platforms that integrate with IAB's Transparency and Consent Framework (TCF) to Moloco Ads SDK SDK. For more information, see [`MolocoPrivacy` documentation](https://moloco.github.io/android-sdk-docs/-moloco%20-s-d-k%20-android/com.moloco.sdk.publisher.privacy/-moloco-privacy) for Android and [TCF Consent String](https://moloco.github.io/documentation/molocosdk/privacy/#TCF-Consent-String) for iOS.

### US states privacy laws

- [US states privacy laws](https://support.google.com/admob/answer/9561022) 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/admob/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.
- The Google Mobile Ads Unity mediation plugin for Moloco Ads SDK includes the `Moloco.SetDoNotSell(bool)` method to pass consent information to the Moloco Ads SDK SDK. The following sample code shows how to pass this consent information to the Moloco Ads SDK SDK. If you choose to set these flags, it is recommended that you do so prior to requesting ads through Google Mobile Ads Flutter Plugin.

```dart
import 'package:gma_mediation_moloco/gma_mediation_moloco.dart';
// ...

GmaMediationMoloco.setDoNotSell(true);
```
- See [Moloco Ads SDK's recommended
  implementation
  instructions](https://moloco.github.io/documentation/molocosdk/privacy/) for [Android](https://moloco.github.io/android-sdk-docs/-moloco%20-s-d-k%20-android/com.moloco.sdk.publisher.privacy/-moloco-privacy/-privacy-settings/index.html) and [iOS](https://moloco.github.io/documentation/molocosdk/privacy/) for more details.

## Step 5: Add required code

- No additional code is required for Moloco Ads SDK integration.

## Step 6: Test your implementation

### Enable test ads

- Make sure you [register your test device](https://developers.google.com/admob/flutter/test-ads.md.txt#enable_test_devices) for AdMob.

> [!IMPORTANT]
> **Important:** Disable test mode for AdMob and Moloco Ads SDK before releasing your app.

### Verify test ads

- To verify that you are receiving test ads from Moloco Ads SDK, enable [single ad source testing](https://developers.google.com/admob/flutter/ad-inspector.md.txt#single_ad_source_testing) in ad inspector using the **Moloco (Bidding)** ad source(s).

## Error codes

- If the adapter fails to receive an ad from Moloco, publishers can check the underlying error from the ad response using [`ResponseInfo`](https://developers.google.com/admob/flutter/response-info.md.txt) under the following classes:

### Android

```java
com.moloco.sdk
com.google.ads.mediation.moloco.MolocoMediationAdapter
```

### iOS

```objective-c
MolocoSDK.MolocoError
GADMediationAdapterMoloco
```
- Here are the codes and accompanying messages thrown by the Moloco adapter when an ad fails to load:

### Android

| Error code | Domain | Reason |
|---|---|---|
| 101 | com.google.ads.mediation.moloco | Missing or invalid Moloco App Key. |
| 102 | com.google.ads.mediation.moloco | Missing or invalid Moloco Ad unit ID. |
| 103 | com.google.ads.mediation.moloco | Moloco ad object returned was null. |
| -1 to 5000 | com.moloco.sdk | Moloco SDK returned an error. See Moloco's [documentation](https://moloco.github.io/android-sdk-docs/-moloco%20-s-d-k%20-android/com.moloco.sdk.publisher/-moloco-ad-error/-error-type/#entries) for more details. |

### iOS

| Error code | Domain | Reason |
|---|---|---|
| 101 | com.google.ads.mediation.moloco | Moloco SDK does not support serving ads on iOS 12 and below. |
| 102 | com.google.ads.mediation.moloco | Missing or invalid Moloco App Key. |
| 103 | com.google.ads.mediation.moloco | Missing or invalid Moloco Ad unit ID. |
| 104 | com.google.ads.mediation.moloco | Ad is not ready to be shown. |
| 105 | com.google.ads.mediation.moloco | Ad failed to show. |
| 106 | com.google.ads.mediation.moloco | Rendering data not available to render the ad. |
| -1 to 5000 | Sent by Moloco SDK | Moloco SDK returned an error. See Moloco's [documentation](https://moloco.github.io/documentation/molocosdk/molocoerror/) for more details. |

## Moloco Flutter Mediation Adapter Changelog

#### Version 3.9.0 (In progress)

#### Version 3.8.0

  - Supports [Moloco Android adapter version 4.13.0.0](https://github.com/googleads/googleads-mobile-android-mediation/blob/main/ThirdPartyAdapters/moloco/CHANGELOG.md#version-41300).
  - Supports [Moloco iOS adapter version 4.11.1.0](https://github.com/googleads/googleads-mobile-ios-mediation/blob/main/adapters/Moloco/CHANGELOG.md#version-41110).
  - Built and tested with the Google Mobile Ads Flutter Plugin version 9.1.0.

#### Version 3.7.1

  - Supports [Moloco Android adapter version 4.12.0.1](https://github.com/googleads/googleads-mobile-android-mediation/blob/main/ThirdPartyAdapters/moloco/CHANGELOG.md#version-41201).
  - Supports [Moloco iOS adapter version 4.10.0.0](https://github.com/googleads/googleads-mobile-ios-mediation/blob/main/adapters/Moloco/CHANGELOG.md#version-41000).
  - Built and tested with the Google Mobile Ads Flutter Plugin version 9.1.0.

#### Version 3.7.0

  - Supports [Moloco Android adapter version 4.12.0.0](https://github.com/googleads/googleads-mobile-android-mediation/blob/main/ThirdPartyAdapters/moloco/CHANGELOG.md#version-41200).
  - Supports [Moloco iOS adapter version 4.10.0.0](https://github.com/googleads/googleads-mobile-ios-mediation/blob/main/adapters/Moloco/CHANGELOG.md#version-41000).
  - Built and tested with the Google Mobile Ads Flutter Plugin version 9.1.0.

#### Version 3.6.1

  - Updated to support Google Mobile Ads Flutter Plugin version 9.1.0.
  - Added Swift Package Manager support.
  - Supports [Moloco Android adapter version 4.11.1.0](https://github.com/googleads/googleads-mobile-android-mediation/blob/main/ThirdPartyAdapters/moloco/CHANGELOG.md#version-41110).
  - Supports [Moloco iOS adapter version 4.9.0.0](https://github.com/googleads/googleads-mobile-ios-mediation/blob/main/adapters/Moloco/CHANGELOG.md#version-4900).
  - Built and tested with the Google Mobile Ads Flutter Plugin version 9.1.0.

#### Version 3.6.0

  - Supports [Moloco Android adapter version 4.11.0.0](https://github.com/googleads/googleads-mobile-android-mediation/blob/main/ThirdPartyAdapters/moloco/CHANGELOG.md#version-41100).
  - Supports [Moloco iOS adapter version 4.9.0.0](https://github.com/googleads/googleads-mobile-ios-mediation/blob/main/adapters/Moloco/CHANGELOG.md#version-4900).
  - Built and tested with the Google Mobile Ads Flutter Plugin version 9.0.0.

#### Version 3.5.1

  - Supports [Moloco Android adapter version 4.10.1.0](https://github.com/googleads/googleads-mobile-android-mediation/blob/main/ThirdPartyAdapters/moloco/CHANGELOG.md#version-41010).
  - Supports [Moloco iOS adapter version 4.8.1.0](https://github.com/googleads/googleads-mobile-ios-mediation/blob/main/adapters/Moloco/CHANGELOG.md#version-4810).
  - Built and tested with the Google Mobile Ads Flutter Plugin version 9.0.0.

#### Version 3.5.0

  - Supports [Moloco Android adapter version 4.10.0.0](https://github.com/googleads/googleads-mobile-android-mediation/blob/main/ThirdPartyAdapters/moloco/CHANGELOG.md#version-41000).
  - Supports [Moloco iOS adapter version 4.8.0.0](https://github.com/googleads/googleads-mobile-ios-mediation/blob/main/adapters/Moloco/CHANGELOG.md#version-4800).
  - Built and tested with the Google Mobile Ads Flutter Plugin version 9.0.0.

#### Version 3.4.0

  - Updated minimum Flutter version to 3.38.1
  - Updated to support Google Mobile Ads Flutter Plugin version 8.0.0
  - Supports [Moloco Android adapter version 4.7.0.0](https://github.com/googleads/googleads-mobile-android-mediation/blob/main/ThirdPartyAdapters/moloco/CHANGELOG.md#version-4700).
  - Supports [Moloco iOS adapter version 4.5.1.0](https://github.com/googleads/googleads-mobile-ios-mediation/blob/main/adapters/Moloco/CHANGELOG.md#version-4510).
  - Built and tested with the Google Mobile Ads Flutter Plugin version 8.0.0.

#### Version 3.3.0

  - Supports [Moloco Android adapter version 4.5.0.0](https://github.com/googleads/googleads-mobile-android-mediation/blob/main/ThirdPartyAdapters/moloco/CHANGELOG.md#version-4500).
  - Supports [Moloco iOS adapter version 4.3.0.2](https://github.com/googleads/googleads-mobile-ios-mediation/blob/main/adapters/Moloco/CHANGELOG.md#version-4302).
  - Built and tested with the Google Mobile Ads Flutter Plugin version 7.0.0.

#### Version 3.2.0

  - Supports [Moloco Android adapter version 4.4.0.0](https://github.com/googleads/googleads-mobile-android-mediation/blob/main/ThirdPartyAdapters/moloco/CHANGELOG.md#version-4400).
  - Supports [Moloco iOS adapter version 4.2.0.0](https://github.com/googleads/googleads-mobile-ios-mediation/blob/main/adapters/Moloco/CHANGELOG.md#version-4200).
  - Built and tested with the Google Mobile Ads Flutter Plugin version 7.0.0.

#### Version 3.1.0

  - Updated minimum Flutter version to 3.35.1
  - Supports [Moloco Android adapter version 4.4.0.0](https://github.com/googleads/googleads-mobile-android-mediation/blob/main/ThirdPartyAdapters/moloco/CHANGELOG.md#version-4400).
  - Supports [Moloco iOS adapter version 4.1.2.0](https://github.com/googleads/googleads-mobile-ios-mediation/blob/main/adapters/Moloco/CHANGELOG.md#version-4120).
  - Built and tested with the Google Mobile Ads Flutter Plugin version 7.0.0.

#### Version 3.0.0

  - Supports [Moloco Android adapter version 4.3.1.0](https://github.com/googleads/googleads-mobile-android-mediation/blob/main/ThirdPartyAdapters/moloco/CHANGELOG.md#version-4310).
  - Supports [Moloco iOS adapter version 4.1.0.0](https://github.com/googleads/googleads-mobile-ios-mediation/blob/main/adapters/Moloco/CHANGELOG.md#version-4100).
  - Built and tested with the Google Mobile Ads Flutter Plugin version 6.0.0.

#### Version 2.1.0

  - Supports [Moloco Android adapter version 4.2.0.0](https://github.com/googleads/googleads-mobile-android-mediation/blob/main/ThirdPartyAdapters/moloco/CHANGELOG.md#version-4200).
  - Supports [Moloco iOS adapter version 3.13.0.0](https://github.com/googleads/googleads-mobile-ios-mediation/blob/main/adapters/Moloco/CHANGELOG.md#version-31300).
  - Built and tested with the Google Mobile Ads Flutter Plugin version 6.0.0.

#### Version 2.0.0

  - Supports [Moloco Android adapter version 4.0.0.0](https://github.com/googleads/googleads-mobile-android-mediation/blob/main/ThirdPartyAdapters/moloco/CHANGELOG.md#version-4000).
  - Supports [Moloco iOS adapter version 3.13.0.0](https://github.com/googleads/googleads-mobile-ios-mediation/blob/main/adapters/Moloco/CHANGELOG.md#version-31300).
  - Built and tested with the Google Mobile Ads Flutter Plugin version 6.0.0.

#### Version 1.6.0

  - Supports [Moloco Android adapter version 3.12.0.0](https://github.com/googleads/googleads-mobile-android-mediation/blob/main/ThirdPartyAdapters/moloco/CHANGELOG.md#version-31200).
  - Supports [Moloco iOS adapter version 3.12.0.0](https://github.com/googleads/googleads-mobile-ios-mediation/blob/main/adapters/Moloco/CHANGELOG.md#version-31200).
  - Built and tested with the Google Mobile Ads Flutter Plugin version 6.0.0.

#### Version 1.5.0

  - Supports [Moloco Android adapter version 3.11.0.0](https://github.com/googleads/googleads-mobile-android-mediation/blob/main/ThirdPartyAdapters/moloco/CHANGELOG.md#version-31100).
  - Supports [Moloco iOS adapter version 3.11.0.0](https://github.com/googleads/googleads-mobile-ios-mediation/blob/main/adapters/Moloco/CHANGELOG.md#version-31100).
  - Built and tested with the Google Mobile Ads Flutter Plugin version 6.0.0.

#### Version 1.4.0

  - Supports [Moloco Android adapter version 3.10.0.0](https://github.com/googleads/googleads-mobile-android-mediation/blob/main/ThirdPartyAdapters/moloco/CHANGELOG.md#version-31000).
  - Supports [Moloco iOS adapter version 3.10.0.0](https://github.com/googleads/googleads-mobile-ios-mediation/blob/main/adapters/Moloco/CHANGELOG.md#version-31000).
  - Built and tested with the Google Mobile Ads Flutter Plugin version 6.0.0.

#### Version 1.3.1

  - Supports [Moloco Android adapter version 3.9.0.0](https://github.com/googleads/googleads-mobile-android-mediation/blob/main/ThirdPartyAdapters/moloco/CHANGELOG.md#version-3900).
  - Supports [Moloco iOS adapter version 3.9.1.0](https://github.com/googleads/googleads-mobile-ios-mediation/blob/main/adapters/Moloco/CHANGELOG.md#version-3910).
  - Built and tested with the Google Mobile Ads Flutter Plugin version 6.0.0.

#### Version 1.3.0

  - Supports [Moloco Android adapter version 3.9.0.0](https://github.com/googleads/googleads-mobile-android-mediation/blob/main/ThirdPartyAdapters/moloco/CHANGELOG.md#version-3900).
  - Supports [Moloco iOS adapter version 3.9.0.0](https://github.com/googleads/googleads-mobile-ios-mediation/blob/main/adapters/Moloco/CHANGELOG.md#version-3900).
  - Built and tested with the Google Mobile Ads Flutter Plugin version 6.0.0.

#### Version 1.2.0

  - Supports [Moloco Android adapter version 3.8.0.1](https://github.com/googleads/googleads-mobile-android-mediation/blob/main/ThirdPartyAdapters/moloco/CHANGELOG.md#version-3801).
  - Supports [Moloco iOS adapter version 3.8.0.0](https://github.com/googleads/googleads-mobile-ios-mediation/blob/main/adapters/Moloco/CHANGELOG.md#version-3800).
  - Built and tested with the Google Mobile Ads Flutter Plugin version 6.0.0.

#### Version 1.1.0

  - Supports [Moloco Android adapter version 3.7.0.0](https://github.com/googleads/googleads-mobile-android-mediation/blob/main/ThirdPartyAdapters/moloco/CHANGELOG.md#version-3700).
  - Supports [Moloco iOS adapter version 3.6.0.0](https://github.com/googleads/googleads-mobile-ios-mediation/blob/main/adapters/Moloco/CHANGELOG.md#version-3600).
  - Built and tested with the Google Mobile Ads Flutter Plugin version 5.3.1.

#### Version 1.0.0

  - Initial release.
  - Supports [Moloco Android adapter version 3.6.1.0](https://github.com/googleads/googleads-mobile-android-mediation/blob/main/ThirdPartyAdapters/moloco/CHANGELOG.md#version-3610).
  - Supports [Moloco iOS adapter version 3.6.0.0](https://github.com/googleads/googleads-mobile-ios-mediation/blob/main/adapters/Moloco/CHANGELOG.md#version-3600).
  - Built and tested with the Google Mobile Ads Flutter Plugin version 5.3.1.