> For the complete documentation index, see [llms.txt](https://docs.blueseasx.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.blueseasx.com/adapters/admob.md).

# AdMob

**Supported Ad Format**

* Interstitial
* Rewarded video
* Banner

### **1.  Integrate BlueSea SDK and Adapter**

### **Android**

To integrate BlueSea SDK and adapter, add dependencies like below into your `build.gradle` file

```
dependencies {
    ...
    implementation 'com.blueseasx:bluesea-ads:1.8.1'
    implementation 'com.blueseasx:admob-adapter:1.8.1.0'
}
```

To reduce video ad loading time, BlueSea SDK allows cleartext traffic to `127.0.0.1` by default in `AndroidManifest.xml`.

* `127.0.0.1` is a local server address used for 'download while playing', which speeds up ad loading and improves impression rates.
* Allowing cleartext traffic to `127.0.0.1` complies with Google policies.

```
<?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>
```

If a `networkSecurityConfig` conflict occurs after introducing the BlueSea SDK, you can replace the `android:networkSecurityConfig` attribute in the `AndroidManifest` file.

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

The SDK requires network permissions to run. After introducing the BlueSea SDK, it will automatically add the network permission declaration in the `AndroidManifest.xml` file. Additionally, starting from Android 12, obtaining the GAID requires a declaration in the `AndroidManifest.xml`. To ensure optimal ad performance, the SDK will automatically add this declaration in the XML file, as shown below:

```
<?xml version="1.0" encoding="utf-8"?>
<manifest ...>
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="com.google.android.gms.permission.AD_ID" />
    <application
        ...
        android:networkSecurityConfig="@xml/network_security_config">
        tools:replace="android:networkSecurityConfig"
        ...
    </application>
</manifest>
```

In addition, the BlueSea SDK is using third-party dependency (`io.appmetrica.analytics:analytics`) to boost publishers’ yield. If your project has already involved this dependency, please read the following description carefully to prevent potential conflicts:&#x20;

The version of this dependency BlueSea used is `7.12.0`. If your project is using a version below than `7.12.0`, we recommend you to upgrade to `7.12.0` or higher version. While you are using a version higher than `7.12.0`, then you don’t have to make any changes.

### **iOS**

Include BlueSea Ads SDK and adapter via CocoaPods. Add below snippet in your Podfile and execute `pod install --repo-update`

```
pod 'BlueSeaSDK', '1.4.1'
pod 'BlueSeaAdmobAdapter', '1.4.1.0'
pod 'Google-Mobile-Ads-SDK', '~> 12.9'
```

Update `SKAdnetwork IDs`. Please perform an incremental update of the IDs provided [here](/ios/skadnetwork-ids.md).

### **2. AdMob Setup**

### **Step1.  Add Custom Event**

Go to  `Mediation ➣ Waterfall sources`  ，Click `Set up ad source ➣ Add custom event` to enter 'add custom event' page.

<div align="left"><img src="/files/VHvmuua7xULVWRlGixOZ" alt="" height="336" width="699"></div>

<div align="left"><img src="/files/72IQcENJQguATfFN0ET5" alt="" height="553" width="699"></div>

Choose the targeted AdMob ad unit and add mapping. The fields need to be applied for the following rules：

* **Mapping name**: `Required`. Name can be customized at your discretion
* **Network eCPM**: `Required`. The eCPM matches the value you’ve set on the BlueSea console.
* **Android Class Name**: `Required`. Please copy the following content: `com.google.ads.mediation.bluesea.customevent.BlueseaCustomEvent`
* **iOS Class Name**: `Required`. Please copy the following content: `BlueSeaAdmobCustomEvent`
* **Parameter**: `Required`. Refer to: `{"app_id":"BlueSea App ID","placement_id":"BlueSea Placement ID"}`

> - The package name or app of the app\_id and placement\_id you input within the Parameter field shall be the same as the app of the AdMob ad unit that is targeted.
> - Parameter field is required and shall be input by strictly referring to the rules introduced above

<div align="left"><img src="/files/AXR1KTu8Ysi3uumgQ0w1" alt="" height="396" width="712"></div>

### **Step2.  AdMob Ad Unit Setup**

Go to `Mediation ➣ Mediation groups`, choose the targeted mediation group to configure custom event waterfall:

<div align="left"><img src="/files/x0tMNlYsGzi7qRsjl1Ne" alt="" height="448" width="712"></div>

In the `Edit mediation group` page, click `Add custom event` and input:

* **Label**: `Required`. Name can be customized at your discretion
* **Manual eCPM**: `Required`. Input floor price of BlueSea Placement ID that you set on the BlueSea console

Then click on Continue to enter mapping setup page

<div align="left"><img src="/files/OKO6mDqxGuOGY07gpMCP" alt="" height="325" width="717"></div>

In the `mapping setup page`, choose the targeted configuration. Please note that the Network eCPM shall be the same as the Manual eCPM. Then click on Done to finish the whole setup.

<div align="left"><img src="/files/HWQToaJflqSVlJxsPIe6" alt="" height="415" width="728"></div>

### **3. Privacy Setup**

If users are subject to privacy regulations such as GDPR, CCPA, or COPPA, developers should fully obtain user consent before initializing the SDK and pass the correct signal to the SDK indicating whether the user authorizes the collection and use of personal information.

The SDK provides the following APIs. Developers should call the corresponding API based on the user’s situation and pass the correct values.

**GDPR**\
This section applies to the EU privacy policy. For details, refer to the [General Data Protection Regulation (GDPR)](https://gdpr.eu/)

If you have integrated a third-party CMP platform, such as Google UMP, the SDK will automatically read the TCF String and determine whether the user has authorized the collection and use of personal information. Please ensure that GDPR settings are completed before initializing the SDK.

If you are not using a third-party CMP platform, the SDK provides a separate API interface. You should determine whether the user is subject to GDPR and fully obtain user consent, passing the correct signal to the SDK regarding whether the user authorizes the collection and use of personal information before initializing the SDK.

If the user is subject to GDPR and has authorized the use of personal information, call the API as follows:

```
BlueseasxSDK.setUserConsent(MainActivity.this, Consent.GDPR, true);
```

If the user is subject to GDPR and has not authorized the use of personal information, call the API as follows:

```
BlueseasxSDK.setUserConsent(MainActivity.this, Consent.GDPR, false);
```

If the user is not subject to GDPR, you do not need to call the above API.

**CCPA**

This section applies to U.S. user privacy regulations, specifically the [California Consumer Privacy Act (CCPA)](https://oag.ca.gov/privacy/ccpa).

You should determine whether the user is subject to the CCPA policy and fully obtain user consent. Before initializing the SDK, pass the correct signal to the SDK’s API interface indicating whether the user authorizes the collection and use of personal information.

If the user is subject to the CCPA and has authorized the use of personal information, call the API as follows:

```
BlueseasxSDK.setUserConsent(MainActivity.this, Consent.CCPA, true);
```

If the user is subject to the CCPA and has not authorized the use of personal information, call the API as follows:

```
BlueseasxSDK.setUserConsent(MainActivity.this, Consent.CCPA, false);
```

If the user is not subject to the CCPA, you do not need to call the above API.

**COPPA**

This section applies to U.S. children’s privacy regulations, specifically the [The Children’s Online Privacy Protection Act (COPPA)](https://www.ftc.gov/business-guidance/privacy-security/childrens-privacy).

If your app is primarily targeted at children (under 13 years old), the Bluesea Ads SDK should not be used for monetization.

If your app is of a mixed audience type, you should determine whether the user is a child under 13 years old. Before initializing the SDK, pass the correct user information to the SDK’s API interface.

If you’ve finished the COPPA setup by using [`setTagForChildDirectedTreatment()`](https://developers.google.com/admob/android/reference/com/google/android/gms/ads/RequestConfiguration.Builder#setTagForChildDirectedTreatment\(int\)) method introduced by AdMob, AdMob will pass the this info to BlueSea SDK, so that you don’t have to use the API provided by BlueSea for this.

If the  [`setTagForChildDirectedTreatment()`](https://developers.google.com/admob/android/reference/com/google/android/gms/ads/RequestConfiguration.Builder#setTagForChildDirectedTreatment\(int\))method is not used, and your app is targeted a mixed audience, please use the API provided by BlueSea as follows:

If the user is a child under 13 years old, call the API as follows:

```
BlueseasxSDK.setUserConsent(MainActivity.this, Consent.COPPA, false);
```

If the user is not a child under 13 years old, call the API as follows:

```
BlueseasxSDK.setUserConsent(MainActivity.this, Consent.COPPA, true);
```

### **4. Testing & Verification**

You can verify whether the BlueSea SDK and Adapter are integrated successfully by following the steps below.

### **Step 1. Configure Test Device IDs**

Log in BlueSea’s console, navigate to `Integration > Test Device IDs.` Add the GAID/IDFA, use the live app id and placement ids to request ads for integration validation.

<div align="left"><img src="/files/XhsnkRBEzJZhGDgCUw5F" alt="" height="291" width="725"></div>

### **Step 2. Test Ad**

You can use [AdMob Ad Inspector](https://developers.google.com/admob/android/ad-inspector?redirect=mts) to request and view BlueSea ads. The following ad format is the BlueSea ad.

<div align="left"><img src="/files/16IndpFgBk4lru1ABQlo" alt="" height="496" width="244"></div>

<br>
