Format setup using UI Inspector

Prior to setup, install the Yandex MobileAds SDK package.

Adding formats using UI Inspector

  1. Open our GitHub repository and download Source code.zip. This archive contains the samples folder with four test files of different formats:

    • App open ads.
    • Rewarded ads.
    • Adaptive banners.
    • Interstitial ads.
  2. Move all files to the Assets folder in the Unity project or use the Inspector tab: Add Component/Yandex Ads/[banner type]. After that, you can attach the components to one of the scenes to test how it works:

Adaptive banner

Unique banner settings

  • Banner types — Inline, Sticky.
  • Position adjustment relative to the screen (Banner Position).
  • Width set to screen size (Use Screen Width).

Event

Event-triggering actions

On Ad Successfully Loaded

Ad loading completion

On Ad Failed To Load

Ad loading failure

On User Left Application

The user exits the app after clicking the ad

On User Returned To Application

The user returns to the app after clicking the ad

On Ad Clicked

The user clicks the ad

On Ad Impression Recorded

Ad impression counted

Interstitial ad

Event

Event-triggering actions

On Ad Successfully Loaded

Ad loading completion

On Ad Failed To Load

Ad loading failure

On Dismissed

Ad closing

On Ad Clicked

The user clicks the ad

On Ad Impression Recorded

Ad impression counted

On Ad Shown

Ad serving

On Ad Failed To Show

Ad serving failure

Rewarded ad

Event

Event-triggering actions

On Ad Successfully Loaded

Ad loading completion

On Ad Failed To Load

Ad loading failure

On Dismissed

Ad closing

On Ad Clicked

The user clicks the ad

On Ad Impression Recorded

Ad impression counted

On Ad Shown

Ad serving

On Ad Failed To Show

Ad serving failure

On Rewarded

Ad impression rewarded

App open ad

Unique banner settings

  • Show AppOpenAd Once: Serve only once per session.

Event

Event-triggering actions

On Ad Successfully Loaded

Ad loading completion

On Ad Failed To Load

Ad loading failure

On Dismissed

Ad closing

On Ad Clicked

The user clicks the ad

On Ad Impression Recorded

Ad impression counted

On Ad Shown

Ad serving

On Ad Failed To Show

Ad serving failure

On App State Change

The app switches to or enters background mode

Terms

Cold start: Launching the app when it isn't present in RAM, which creates a new app session.

Hot start: Bringing the app from background mode, where it's paused in RAM, into foreground mode.

Features of app open ad integration

  • Ads may take a long time to load, so you should avoid increasing the cold start time if the ad hasn't loaded.
  • Preload ads for subsequent hot start impressions.
  • We don't recommend loading app open ads simultaneously with other ad formats at app startup, as the app may be downloading essential operational data. This may cause excessive load on your device and internet connection, resulting in longer ad load times.
  • If the OnAdFailedToLoad event returns an error, don't try to load a new ad again. If you really have to, limit the number of ad loading retries — this will help you avoid constant unsuccessful requests and connection issues if there are limitations.

General banner settings

  • Component name: You can use any name, this won't have any impact.

  • Ad Unit Id:

    • Development mode to work with demo ad units.

    • Production mode to work with R-M-XXXXXX-Y (for the actual ID, check the Yandex Advertising Network interface). R-M-XXXXXX-Y is a template for your actual ad unit ID that will be used to receive various creatives.

  • Loading and serving settings:

    • Auto Load: Instant loading upon automatic SDK initialization.
    • Show After Loading: Instant serving after ad loading.
  • Public component methods are the same:

    • Load(): Manual ad loading.
    • Show(): Manual ad serving.
    • onDestroy(): Ad object removal.
  • Event processing using Unity Inspector: any event can be linked to your custom scripts' methods via Inspector. Click the plus icon, then select an object and the desired method.

  • For all events, you can create public void methods with the necessary signature for parameterized calls.

    For example:

    public void InterstitialSomeMethod(string message) {
        Debug.Log("Interstitial show msg: " + message);
    }