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

# Integrating Yandex Mobile Mediation

{% note warning %}

Be sure to update to the latest adapter versions ([Yandex Mobile Mediation](https://ads.yandex.com/helpcenter/en/dev/react-native/list-network.md)). Otherwise, errors from improper adapter integration might occur, preventing the ad from being served.

{% endnote %}

[Yandex Mobile Mediation](https://ads.yandex.com/helpcenter/en/monetization/yandex-mediation/index.md) is a platform that automatically selects ads from a variety of ad networks using ML algorithms, which helps you maximize your revenue. All settings are preconfigured, so you can start using it immediately without having to set up each network individually.
If you've been using the Mobile Ads SDK with a single Yandex network, migrating to Yandex Mediation requires no code changes. You only need to preset the sections of third-party advertising networks' web interfaces.

## 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 23 or higher.
      - compileSdkVersion 34 or higher.

- iOS

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

{% endlist %}

### Set up the app 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 React Native plugin {#plugin-integrating}

<!-- source: en/dev/_includes/add-react-native.md -->
To integrate the Yandex Mobile Ads SDK into a React Native app, use the [Yandex Mobile Ads React Native plugin](https://www.npmjs.com/package/yandex-mobile-ads).

Install the Yandex Mobile Ads React Native plugin in your project. Run the following command from the project's root folder:

```
npm install yandex-mobile-ads
```

Once the plugin is added, a string with the following dependency appears in the `package.json` file:

```
"dependencies": {
    "yandex-mobile-ads": "^8.2.0"
}
```
<!-- endsource: en/dev/_includes/add-react-native.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>
      <uses-permission android:name="com.google.android.gms.permission.AD_ID" tools:node="remove"/>
   </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 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 %}

## Enabling mediation {#activate}

### Connecting individual adapters

{% note warning %}

Be sure to update to the latest adapter versions ([Yandex Mobile Mediation](https://ads.yandex.com/helpcenter/en/dev/react-native/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://ads.yandex.com/helpcenter/en/monetization/yandex-mediation/setup.md) in the Yandex Advertising Network interface.
   1. Add a YandexMobileAds dependency to the build.gradle file of your app module:
      ```groovy
      dependencies {
          ...
          implementation 'com.yandex.android:mobileads:x.x.x' // add supported version

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

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

          compileOptions {
              sourceCompatibility JavaVersion.VERSION_1_8
              targetCompatibility JavaVersion.VERSION_1_8
          }
      }
      ```
   1. Add the following code to the build.gradle file of 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 -->

   1. Set up permission to use an advertising ID (for apps using SDK versions older than 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 permission and access to the ID may impact your revenue, because your app may serve less relevant ads.

      {% endnote %}

   1. Connect the required [adapters](https://ads.yandex.com/helpcenter/en/dev/react-native/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://ads.yandex.com/helpcenter/en/monetization/yandex-mediation/setup.md) in the Yandex Advertising Network interface.
   1. Add the `YandexMobileAds` library to your Podfile.

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

   1. Connect the required [adapters](https://ads.yandex.com/helpcenter/en/dev/react-native/list-network.md) separately using the appropriate libraries.

{% endlist %}

### Initializing the Yandex Mobile Ads SDK library

<!-- source: en/dev/_includes/init-sdk-react-native.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.

Add a `MobileAds.initialize();` call to your main component's `useEffect` hook:

```ts
React.useEffect(() => {
    (async () => {
        // Configure the user privacy data policy before init sdk
        await MobileAds.initialize();
    })();
});
```
<!-- endsource: en/dev/_includes/init-sdk-react-native.md -->

If you need to set up [privacy policies for personal data](https://ads.yandex.com/helpcenter/en/dev/react-native/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.

## Learn more

[Plugin integration errors](https://ads.yandex.com/helpcenter/en/dev/react-native/react-native-errors.md#integration)
