---
metadata:
  - name: generator
    content: Diplodoc Platform v5.50.6
alternate:
  - https://ads.yandex.com/helpcenter/en/dev/compose-multiplatform/quick-start-mm.md
  - https://ads.yandex.com/helpcenter/ru/dev/compose-multiplatform/quick-start-mm.md
  - https://ads.yandex.com/helpcenter/zh/dev/compose-multiplatform/quick-start-mm.md
---
> **Documentation Index:** Fetch the complete configuration index at https://ads.yandex.com/helpcenter/en/llms.txt

# Integrating Yandex Mediation

[Mobile mediation](https://ads.yandex.com/helpcenter/en/monetization/yandex-mediation/index.md) is a platform that automatically selects ads from a multitude of networks based on ML algorithms. to maximize your revenue. All settings are turnkey, meaning there's no need to debug each network separately.
If you previously used the Mobile Ads SDK with only one Yandex network, you won't need to change anything in the code to switch to Yandex Mediation. You only need to pre-configure the units in the web interface of external ad networks.

## Preliminary setup

To prepare your app, follow the steps from the next sections.

### App requirements {#requirements}

{% list tabs %}

- Android

   - Use Android Studio 2021 or later.
   - Make sure your app's build file uses the following values:
      - minSdkVersion 21 or later.
      - compileSdkVersion 31 or later.
   - To load ads no matter the type, you need Android 4.1 or later.
   - Video ads are only selected for devices with Android 5 or higher.

- iOS

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

{% endlist %}

### Set up the application in your Yandex Advertising Network account

<!-- source: en/dev/_includes/reg.md -->
Here's how to register your app in the Yandex Advertising Network:

1. [Log in](https://partner.yandex.com/) or [register](https://passport.yandex.ru/auth/list?origin=rsy_ligth_in&retpath=https%3A%2F%2Fpartner.yandex.ru%2Fform%2F?roles%5B%5D=27) your account in the Yandex Advertising Network.
2. [Register](https://passport.yandex.ru/auth/list?origin=rsy_ligth_in&retpath=https%3A%2F%2Fpartner.yandex.ru%2Fform%2F?roles%5B%5D=27) your app in the Yandex Advertising Network.
<!-- endsource: en/dev/_includes/reg.md -->

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

<!-- source: en/dev/_includes/add-compose-multiplatform.md -->
To integrate the Yandex Mobile Ads SDK with your Compose Multiplatform app, add the Yandex Mobile Ads Compose Multiplatform dependency to your shared module and connect the native iOS SDK with CocoaPods.

**Gradle**

In the shared module `build.gradle.kts`, declare the artifact in `commonMain`:

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

**iOS (CocoaPods)**

Add the `YandexMobileAds` pod to your iOS app `Podfile` (for example, `iosApp/Podfile`). Use the same target name as in Xcode:

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

platform :ios, '13.0'

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

Install pods from the directory that contains the `Podfile`:

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

### Platform-specific setup {#config}

{% list tabs %}

- Android

   **Permission to use the ad ID**

   The ad ID is a unique identifier provided by Google Play services for displaying ads to users who opt in to personalized ads. Users can opt out of ad personalization or reset their ID in the settings. In this case, advertising networks won't be able to use the ID to select relevant ads for the user.

   You can delete the permission if necessary. For example, if a policy does not allow the use of an ID for ad selection, such as the Families Policy.

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

   {% note warning %}

   Lack of this permission and access to the ID may reduce the relevance of ads and, as a result, your income.

   {% endnote %}

   **COPPA setup**

   You can set up your privacy policies for personal data manually or using the `AndroidManifest.file` right before initializing the SDK.

   At automatic initialization, add the following code to `AndroidManifest.xml` to notify the Yandex Mobile Ads SDK that the app is used by children:
   ```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 ad network identifiers to your app's `Info.plist` file. For instructions, see [SKAdNetwork](https://ads.yandex.com/helpcenter/en/dev/ios/skadnetwork.md).

{% endlist %}

## Integrating mediation

### Adding individual adapters

{% note warning %}

Make sure to update your used [Yandex mobile mediation](https://ads.yandex.com/helpcenter/en/dev/compose-multiplatform/list-network.md) adapters to the latest version. Older versions may cause adapter integration errors that can prevent your ads from being served.

{% endnote %}

{% list tabs %}

- Android

   To add individual adapters, enable Yandex Ads SDK and relevant adapters by following the instructions:

   1. [Set up mediation](https://ads.yandex.com/helpcenter/en/monetization/yandex-mediation/setup.md) in the Yandex Advertising Network 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") // add supported version

          // Add dependencies on Yandex Mediation adapters.
      }
      ```

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

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

      <!-- source: en/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/"
      }

      // 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/dev/_includes/build-gradle-code.md -->

   5. Set up permission to use the ad ID (for apps running SDK versions below 4.5.0).

      <!-- source: en/dev/_includes/ad-id.md -->
      {% cut "How to set up permission to use the ad ID" %}

      The ad ID is a unique identifier provided by Google Play services for displaying ads to users who opt in to personalized ads. Users can opt out of ad personalization or reset their ID in the settings. In this case, advertising networks won't be able to use the ID to select relevant ads for the user.

      If your app runs a Yandex Mobile Ads SDK version below 4.5, add com.google.android.gms.permission.AD_ID to the 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>
      ```

      As of version 4.5.0, the Yandex Mobile Ads SDK adds com.google.android.gms.permission.AD_ID by default. Because of this, you don't have to specify it in the application's main manifest. The permission allows you to use an ad ID to select more relevant ads from advertising networks.

      You can delete the permission if necessary. For example, if a policy does not allow the use of an ID for ad selection, such as the Families Policy.

      To keep the permission from being added to the application's main manifest, add the following code to AndroidManifest.xml:
      ```xml
      <manifest>
          <application>
              <uses-permission android:name="com.google.android.gms.permission.AD_ID" tools:node="remove"/>
          </application>
      </manifest>
      ```
      {% endcut %}
      <!-- endsource: en/dev/_includes/ad-id.md -->

      {% note warning %}

      Lack of this permission and access to the ID may reduce the relevance of ads and, as a result, your income.

      {% endnote %}

   6. Add the applicable [adapters](https://ads.yandex.com/helpcenter/en/dev/compose-multiplatform/list-network.md) one by one using the appropriate packages.

- iOS

   To add individual adapters, enable Yandex Ads SDK and relevant adapters by following the instructions:

   1. [Set up mediation](https://ads.yandex.com/helpcenter/en/monetization/yandex-mediation/setup.md) in the Yandex Advertising Network interface.
   2. Add the `YandexMobileAds` library to the Podfile.

      ```
      pod 'YandexMobileAds', 'x.x.x' // Add the supported version
      ```

   3. Add the applicable [adapters](https://ads.yandex.com/helpcenter/en/dev/compose-multiplatform/list-network.md) one by one using the appropriate libraries.

{% endlist %}

## Initializing the Yandex Mobile Ads SDK library

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

By default, for Android, SDK is initialized **automatically at your app startup**. That accelerates ad loading and consequently increases your monetization revenue.

By default, for iOS, SDK initialization happens **automatically before ads load**, but manual initialization will speed up how quickly the first ad loads and therefore increase revenue from monetization.

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/dev/_includes/init-sdk-compose-multiplatform.md -->

If your app requires setting up [privacy policies for data use](https://ads.yandex.com/helpcenter/en/dev/compose-multiplatform/gdpr.md), do that before initializing the Yandex Mobile Ads SDK.

You can set up your privacy policies for personal data manually or using the `AndroidManifest.file` right before initializing the SDK.
