---
metadata:
  - name: generator
    content: Diplodoc Platform v5.57.3
alternate:
  - https://boost.yandex.ru/doc/en/ad-monetization/dev/compose-multiplatform/quick-start-mm.md
  - https://boost.yandex.ru/doc/ru/ad-monetization/dev/compose-multiplatform/quick-start-mm.md
  - href: en/ad-monetization/dev/compose-multiplatform/quick-start-mm.md
    type: text/markdown
    title: Markdown version
  - href: llms.txt
    type: text/markdown
    title: llms.txt
---
> **Documentation Index:** Fetch the complete configuration index at https://boost.yandex.ru/doc/en/llms.txt

# Integration Yandex Mediation

{% note warning %}

Be sure to update to the latest adapter versions ([Yandex Mediation](https://boost.yandex.ru/doc/en/ad-monetization/dev/compose-multiplatform/list-network.md)). Otherwise, errors from improper adapter integration might occur, preventing the ad from being served.

{% endnote %}

## Prerequisites

To prepare your app, follow the steps described in the next sections.

### App requirements {#requirements}

{% list tabs %}

- Android

  - Use Android Studio 2021 or higher.
  - Check that your app's build file uses the following values:
     - minSdkVersion 21 or higher.
     - compileSdkVersion 31 or higher.
  - To load any type of ad, Android version 4.1 or higher is required.
  - Video ads are only served for devices with Android 5 or higher.

- iOS

  - Use iOS 13 or higher.
  - Use Xcode 16.4 or higher.

{% endlist %}

### Set up the app in your Boost account

<!-- source: en/ad-monetization/dev/_includes/reg.md -->
Register your app as a Boost app by following these steps:

1. [Log in](https://boost.yandex.com/) for the Boost.
2. [Register](https://boost.yandex.com/) your app in the Boost.
<!-- endsource: en/ad-monetization/dev/_includes/reg.md -->

## Connecting the Yandex Mobile Ads Compose Multiplatform library {#library-integrating}

<!-- source: en/ad-monetization/dev/_includes/add-compose-multiplatform.md -->
To integrate Yandex Mobile Ads SDK into your Compose Multiplatform app, add the Yandex Mobile Ads Compose Multiplatform dependency to your common module and include the native iOS SDK via CocoaPods.

**Gradle**

Declare the artifact in `commonMain` within the common module's `build.gradle.kts` file:

```kotlin
commonMain.dependencies {
    implementation("com.yandex.ads.multiplatform:mobileads-compose:8.3.0")
}
```

**iOS (CocoaPods)**

Add the `YandexMobileAds` pod to your iOS app's `Podfile` (for example, `iosApp/Podfile`). The target name must match the target in Xcode:

```ruby
source 'https://cdn.cocoapods.org/'

platform :ios, '13.0'

target 'iosApp' do
  use_frameworks!
  pod 'YandexMobileAds', '8.3.0'
end
```

Install pods from the directory where your `Podfile` is located:

```
cd iosApp && pod install
```
<!-- endsource: en/ad-monetization/dev/_includes/add-compose-multiplatform.md -->

### Platform-specific setup {#config}

{% list tabs %}

- Android

   **Permission to use the advertising ID**

   Advertising IDs are unique IDs provided by Google Play services. They're used to serve ads to users who consent to personalized ads. Users can opt out of personalized ads or reset the ID in the settings. In this case, ad networks can't use it to serve relevant ads.

   You can remove the permission, if necessary. For example, you may need to do this if a policy, such as the Families Policy, doesn't allow using the ID to serve ads.

   To prevent the permission from being added to your app's main manifest, add the following to the AndroidManifest.xml file:
   ```xml
   <manifest>
       <application>
           <uses-permission android:name="com.google.android.gms.permission.AD_ID" tools:node="remove"/>
       </application>
   </manifest>
   ```

   {% note warning %}

     Lack of permission and access to the ID may impact your revenue, because your app may serve less relevant ads.

   {% endnote %}

   **COPPA setup**

   You can set up these policies using the AndroidManifest.file or right before initializing the SDK manually.

   If you've chosen automatic initialization, add the following code to the AndroidManifest.xml file to notify the Yandex Mobile Ads SDK when the app user is a child:
   ```xml
   <manifest>
       <application>
           <!-- Disable the use of child's personal data for app monetization.  -->
           <meta-data
             android:name="@string/yandex_mobileads_age_restricted_user"
             android:value="true" />
       </application>
   </manifest>
   ```

- iOS

  **SKAdNetwork support**

  Add the ad network identifiers to your app's `Info.plist` file. For more information, see [SKAdNetwork](https://boost.yandex.ru/doc/en/ad-monetization/dev/ios/skadnetwork.md).

{% endlist %}

## Enabling mediation

### Connecting individual adapters

{% note warning %}

Be sure to update to the latest adapter versions ([Yandex Mobile Mediation](https://boost.yandex.ru/doc/en/ad-monetization/dev/compose-multiplatform/list-network.md)). Otherwise, errors from improper adapter integration might occur, preventing the ad from being served.

{% endnote %}

{% list tabs %}

- Android

  To connect individual adapters, enable the Yandex Ads SDK, then follow the specific instructions for each adapter:

  1. [Set up mediation](https://boost.yandex.ru/doc/en/ad-monetization/monetization/yandex-mediation/setup.md) in the Boost interface.
  2. Add the YandexMobileAds dependency to the `androidMain.dependencies` block in the `build.gradle.kts` file at the app level:
     ```kotlin
     androidMain.dependencies {
         ...
         implementation("com.yandex.android:mobileads:x.x.x") // Specify the supported version

         // Adapter dependencies Yandex Mediation.
     }
     ```

  3. Add support for Java 8 to the `build.gradle` file of your app's Android module:
     ```groovy
     android {

         compileOptions {
             sourceCompatibility JavaVersion.VERSION_1_8
             targetCompatibility JavaVersion.VERSION_1_8
         }
     }
     ```
  4. Add this code to the `build.gradle` file in your app's Android module:

     <!-- source: en/ad-monetization/dev/_includes/build-gradle-code.md -->
     ```groovy
     // IronSource
     maven {
            url 'https://android-sdk.is.com/'
     }

     // Pangle
     maven {
            url 'https://artifact.bytedance.com/repository/pangle'
     }

     // Tapjoy
     maven {
            url "https://sdk.tapjoy.com/"
     }

     // BidMachine
     maven {
            url 'https://artifactory.bidmachine.io/bidmachine'
     }

     // Mintegral
     maven {
            url "https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea"
     }

     // Chartboost
     maven {
            url "https://cboost.jfrog.io/artifactory/chartboost-ads/"
     }

     // AppNext
     maven {
            url "https://dl.appnext.com/"
     }
     ```
     <!-- endsource: en/ad-monetization/dev/_includes/build-gradle-code.md -->

  5. Set up permission to use an advertising ID (for apps using SDK versions older than 4.5.0).

     {% include notitle [ad-id](../_includes/ad-id.md) %}

     {% note warning %}

      Lack of permission and access to the ID may impact your revenue, because your app may serve less relevant ads.

     {% endnote %}

  6. Connect the required [adapters](https://boost.yandex.ru/doc/en/ad-monetization/dev/compose-multiplatform/list-network.md) separately using the appropriate packages.

- iOS

  To connect individual adapters, enable the Yandex Ads SDK, then follow the specific instructions for each adapter:

  1. [Set up mediation](https://boost.yandex.ru/doc/en/ad-monetization/monetization/yandex-mediation/setup.md) in the Boost interface.
  2. Add the `YandexMobileAds` library to your Podfile.

     ```
     pod 'YandexMobileAds', 'x.x.x' // add supported version
     ```

  3. Connect the required [adapters](https://boost.yandex.ru/doc/en/ad-monetization/dev/compose-multiplatform/list-network.md) separately using the appropriate libraries.

{% endlist %}

## Initializing the Yandex Mobile Ads SDK library

<!-- source: en/ad-monetization/dev/_includes/init-sdk-compose-multiplatform.md -->
Successfully initializing the Yandex Mobile Ads SDK is a prerequisite for correctly integrating the library.

By default, the SDK for Android is initialized automatically on **app startup**. This speeds up ad loading and thus increases your monetization revenue.

By default, the SDK for iOS is initialized automatically **before loading an ad**. However, manual initialization can speed up the loading of the first ad, increasing your monetization revenue.

Call `YandexAds.initialize()` before loading any ads — for example, from your root composable using `LaunchedEffect`:

```kotlin
import com.yandex.mobile.ads.kmp.YandexAds

@Composable
fun App() {
    LaunchedEffect(Unit) {
        YandexAds.initialize()
    }
    // ...
}
```
<!-- endsource: en/ad-monetization/dev/_includes/init-sdk-compose-multiplatform.md -->

If you need to set up [privacy policies for personal data](https://boost.yandex.ru/doc/en/ad-monetization/dev/compose-multiplatform/gdpr.md) in your app, make sure to do this before initializing the Yandex Mobile Ads SDK.

You can set up these policies using the AndroidManifest.file or right before initializing the SDK manually.

{% included (../_includes/ad-id.md) %}
# Ad ID

{% cut "How to set up permission to use the ad ID" %}

  Advertising IDs are unique IDs provided by Google Play services. They're used to serve ads to users who consent to personalized ads. Users can opt out of personalized ads or reset the ID in the settings. In this case, ad networks can't use it to serve relevant ads.

  If your app uses a Yandex Mobile Ads SDK version lower than 4.5.0, add the com.google.android.gms.permission.AD_ID permission to your app's AndroidManifest.xml file:
  ```xml
  <manifest>
      <application>
      <!-- For apps targeting Android 13 or higher & Yandex Mobile Ads SDK versions lower than 4.5.0 -->
          <uses-permission android:name="com.google.android.gms.permission.AD_ID"/>
      </application>
  </manifest>
  ```

  Starting with version 4.5.0, Yandex Mobile Ads SDK adds the com.google.android.gms.permission.AD_ID permission by default. This means you don't need to specify it in your app's main manifest. With this permission, you can use the advertising ID to serve more relevant ads from ad networks.

  You can remove the permission, if necessary. For example, you may need to do this if a policy, such as the Families Policy, doesn't allow using the ID to serve ads.

  To prevent the permission from being added to your app's main manifest, add the following to the AndroidManifest.xml file:
  ```xml
  <manifest>
      <application>
          <uses-permission android:name="com.google.android.gms.permission.AD_ID" tools:node="remove"/>
      </application>
  </manifest>
  ```
{% endcut %}

{% endincluded %}