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

# Rewarded ads

<!-- source: en/dev/_includes7/rewarded.md -->
Rewarded ads are a popular full-screen ad format, where the user receives a reward for viewing the ad.
<!-- endsource: en/dev/_includes7/rewarded.md -->

<!-- source: en/dev/_includes7/rewarded.md -->
The display of this ad type is activated by the user, for instance, to receive a bonus or additional life in a game.
<!-- endsource: en/dev/_includes7/rewarded.md -->

<!-- source: en/dev/_includes7/rewarded.md -->
High user motivation makes this ad format the most popular and profitable in free apps.
<!-- endsource: en/dev/_includes7/rewarded.md -->

{% cut "Appearance" %}

{% list tabs %}

- Text and image ads

  <iframe width="200" height="405.5" allow="autoplay" src="https://runtime.strm.yandex.ru/player/video/vplv6tshzb3euhokoa5q?autoplay=1&mute=0&loop=1&loop=1" frameborder="0" allowfullscreen></iframe>

- Video ads

  <iframe width="200" height="405.5" allow="autoplay" src="https://runtime.strm.yandex.ru/player/video/vplvv2aom7x2nte5gckn?autoplay=1&mute=0&loop=1&loop=1" frameborder="0" allowfullscreen></iframe>

{% endlist %}

{% endcut %}

This guide covers the process of integrating rewarded ads into React Native apps.
Besides code samples and instructions, it also contains format-specific recommendations and links to additional resources.

## Prerequisite {#pre}

<!-- source: en/dev/_includes7/pre-react-native.md -->
1. Follow the Yandex Mobile Ads React Native plugin integration steps described under [Quick start](https://ads.yandex.com/helpcenter/en/dev/react-native7/quick-start.md).
2. Make sure that you have the [latest version of the Yandex Mobile Ads React Native plugin](https://ads.yandex.com/helpcenter/en/dev/platforms.md). If you're using mediation, update to the most recent [single build version](https://ads.yandex.com/helpcenter/en/dev/platforms.md).
<!-- endsource: en/dev/_includes7/pre-react-native.md -->

## Implementation {#implement}

Key steps for integrating rewarded ads:

* Create and configure a `RewardedAdLoader`.
* Set up the parameters for loading ads using an `AdRequestConfiguration` object.
* Load the `RewardedAd` object.
* Set the ad's callback functions.
* Display the `RewardedAd` object.
* Reward the user for viewing the ad.

## Features of rewarded ad integration {#features}

If the `loadAd` method returns an error, don't try to load a new ad again. If there's no other option, limit the number of ad load retries. This will help avoid constant unsuccessful requests and connection issues if there are limitations.

## Loading ads

To load your rewarded ads, create a `RewardedAdLoader` object. To do this, call the `RewardedAdLoader.create()` method.

To create an `AdRequestConfiguration` class instance, you'll need the placement ID from the Yandex Advertising Network interface (adUnitId).

You can also expand ad request parameters by providing information about the user's interests, page context, location, and other additional data when creating the `AdRequestConfiguration` object. Extra context added to ad requests can greatly improve the ad quality. Read more in the [Ad Targeting](https://ads.yandex.com/helpcenter/en/dev/react-native7/target.md) section.

To load your rewarded ad, call the `loadAd` method of the `RewardedAdLoader` class object.

The example below shows how to load a rewarded ad:

```ts
let loader = await RewardedAdLoader.create()
    .catch((error) => {
        // Handle error gracefully
        return;
    });
if (!loader) {
    return;
}
let adRequestConfiguration = new AdRequestConfiguration({
    adUnitId: 'R-M-XXXXXX-Y', // for debug you can use 'demo-rewarded-yandex'
    age: '20',
    contextQuery: 'context-query',
    contextTags: ['context-tag'],
    gender: Gender.Female,
    location: new Location(55.734202, 37.588063),
});
let ad = await loader.loadAd(adRequestConfiguration)
    .then((ad) => {
        // Ad loaded successfully
        return ad;
    })
    .catch((error) => {
        // Handle error gracefully
        return;
    });
```

## Displaying ads

Rewarded ads are an incentivized ad format that allows users to earn rewards by viewing ads. These rewards may include extra lives or the ability to advance to the next level in a game. The reward format is determined by the app itself.

To track a rewarded ad's lifecycle and reward events, set callback functions for the `RewardedAd` class object.

To display a rewarded ad, use the `show()` method:

```ts
ad.onAdShown = () => {
    console.log('Did show');
};
ad.onAdFailedToShow = (error) => {
    console.log(`Did fail to show with error: ${JSON.stringify(error)}`);
};
ad.onAdClicked = () => {
    console.log('Did click');
};
ad.onAdDismissed = () => {
    console.log('Did dismiss');
};
ad.onAdImpression = (impressionData) => {
    console.log(`Did track impression: ${JSON.stringify(impressionData)}`);
};
ad.onRewarded = (reward) => {
    console.log(`Did reward: ${JSON.stringify(reward)}`);
}
ad.show();
```

## Testing rewarded ad integration {#test}

{% list tabs %}

- Android

   <!-- source: en/dev/_includes7/test-android-rewarded.md -->
   ### Using demo ad units for ad testing {#demo-blocks}

   We recommend using test ads to test your rewarded ad integration and your app itself.

   To guarantee that test ads are returned for every ad request, we created a special demo ad placement ID. Use it to check your ad integration.

   Demo adUnitId: `demo-rewarded-yandex`.

   {% note warning %}

   Before publishing your app in the store, make sure to replace the demo ad placement ID with a real one obtained from the Yandex Advertising Network interface.

   {% endnote %}

   You can find the list of available demo ad placement IDs in the [Demo ad units for testing](https://ads.yandex.com/helpcenter/en/dev/android7/demo-blocks.md) section.

   ### Testing ad integration {#test-int}

   You can test your rewarded ad integration using the SDK's built-in analyzer.

   The tool checks makes sure your rewarded ads are integrated properly and outputs a detailed report to the log.
   To view the report, search for the “YandexAds” keyword in the [Logcat](https://developer.android.com/studio/command-line/logcat) tool for Android app debugging.
   ```bash
   adb logcat -v brief '*:S YandexAds'
   ```

   If the integration is successful, you'll see this message:
   ```bash
   adb logcat -v brief '*:S YandexAds'
   mobileads$ adb logcat -v brief '*:S YandexAds'
   I/YandexAds(13719): [Integration] Ad type rewarded was integrated successfully
   ```

   If you're having problems integrating rewarded ads, you'll get a detailed report on the issues and recommendations for how to fix them.
   <!-- endsource: en/dev/_includes7/test-android-rewarded.md -->

- iOS

   ### Using demo ad units for ad testing

   <!-- source: en/dev/_includes7/test-ios-rewarded.md -->
   We recommend using test ads to test your ad integration and your app itself.

   To guarantee that test ads are returned for every ad request, we created a special demo ad placement ID. Use it to check your ad integration.

   Demo adUnitId: `demo-rewarded-yandex`.

   {% note warning %}

   Before publishing your app to the store, make sure you replace the demo ad unit ID with a real one obtained from the Yandex Advertising Network interface.

   {% endnote %}

   You can find the list of available demo ad placement IDs in the [Demo ad units for testing](https://ads.yandex.com/helpcenter/en/dev/ios7/demo-blocks.md) section.
   <!-- endsource: en/dev/_includes7/test-ios-rewarded.md -->

   ### Testing ad integration

   <!-- source: en/dev/_includes7/test-integration-ios.md -->
   You can test your ad integration using the native Console tool.

   To view detailed logs, call the `MobileAds` class's `enableLogging` method.

   ```swift
   MobileAds.enableLogging()
   ```

   To view SDK logs, go to the Console tool and set `Subsystem = com.mobile.ads.ads.sdk`. You can also filter logs by category and error level.

   If you're having problems integrating ads, you'll get a detailed report on the issues and recommendations for how to fix them.

   <img src= "https://yastatic.net/s3/doc-binary/src/dev/mobile-ads/common/integration-ios-2.png">
   <!-- endsource: en/dev/_includes7/test-integration-ios.md -->

{% endlist %}

## Tips

### Ad preloading

<!-- source: en/dev/_includes7/preload.md -->
Loading an ad may take several seconds, depending on the number of ad networks connected in mobile mediation and the user's internet speed. We recommend preloading ads before displaying them.
<!-- endsource: en/dev/_includes7/preload.md -->

Call the `loadAd` method in advance to instantly show the ad when it's needed.

To begin preloading the next ad immediately after serving the current one, you can link this process to the `onAdDismissed` event.

<!-- source: en/dev/_includes7/cash-ads.md -->
If you cache ads on too many screens that are unlikely to be shown, your ad effectiveness could drop. For example, if users complete 2-3 game levels per session, you shouldn't cache ads for 6-7 screens. Your ad viewability could decrease otherwise, and the advertising system might deprioritize your app.

To make sure you're finding a good balance for your app, track the "Share of impressions" or "Share of visible impressions" metric in the Yandex Advertising Network interface. If it's under 20%, you should probably revise your caching algorithm. The higher the percentage of impressions, the better.
<!-- endsource: en/dev/_includes7/cash-ads.md -->

## Additional resources {#resources}

* <!-- source: en/dev/_includes7/github-pubdev-links.md -->
  Link to [GitHub](https://github.com/yandexmobile/yandex-ads-react-native-plugin).
  <!-- endsource: en/dev/_includes7/github-pubdev-links.md -->
