Working with advertising

General principle of interaction with ad units.

Identifiers from personal account

Publisher identifier (publisher_id)

To initialize the SDK you will need the publisher identifier (publisher_id)

Your publisher_id is located in the "Settings" section of your Madex personal account.

Ad unit identifier (placement_name)

When using SDK methods, you will need the ad unit identifier (placement_name) of the ad unit.

placement_name is the ID of the ad unit. Ad units are created in Madex personal account.

Test identifiers

During SDK integration, we recommend using special publisher_id and placement_name to get stable test ads.

Publisher ID - d42994c6-2145-4269-9c2f-2adcf9d9703f

International format

Madex Interstitial ID - 50f37030-162d-4e8c-a9c0-e078d8fbf2f7

IronSource Interstitial ID - 82e3bba6-6add-4594-8bb7-f96fef5b252d

Rewarded Video Format

Madex Rewarded ID - dacd566d-8487-4bc6-8afc-486f625be870

IronSource Rewarded ID - 42e716e1-91c0-47e0-9832-c36ada6fa836

Формат Banner

Madex Banner ID - 901a609e-b9b2-4f82-b8b8-c899c5524867

Advertising Formats

The Madex advertising network supports 2 ad formats.

Fullscreen Banner (Interstitial)

The ad is displayed on the entire screen and contains a banner, interactive banner, or video. Tapping on it leads to a transition to the link specified by the advertiser.

Users can close the banner after 3 seconds.

This format is typically used when launching the application or transitioning between application screens.

Here's an example method call to display this format of advertising.

Rewarded Video

The ad is displayed on the entire screen and contains a video or interactive banner. Tapping on it leads to a transition to the link specified by the advertiser.

Users can stop viewing the ad, but in this case, they will see a dialog warning about the lack of a reward when closing the video before its completion.

Here's an example method call to display this format of advertising.

To determine whether to reward the user, use the onRewardedFinished event.

More details on working with events are described below.

The ad is displayed at the bottom of the screen and contains an interactive banner. Tapping on it leads to a transition to the link specified by the advertiser.

Here's an example method call to display this format of advertising.

Custom Settings for Banner 320x50

Auto-Refresh of Banner Ads

To increase your profits, we have developed a function for automatic content change in the banner.

To configure, specify the interval in seconds (minimum 10 seconds).

By default, the banner is positioned at the bottom of the screen, but you can override this behavior.

Show close button

By default, the close banner button is not shown, but you can enable it.

Addon Methods

Working with ads involves working with Madex SKD methods.

  1. Initialize (required): Initializes the SDK. It is sufficient to call this action once at the layout start or before the first ad load.

  2. LoadInterstitialAd / LoadRewardedAd / LoadBannerAd (required): Loads ads from the server. This method is usually called in advance so that the content is loaded by the time of display. In this case, the user's wait time for ad display will be minimal.

  3. ShowInterstitialAd / ShowRewardedAd / ShowBannerAd (required): Triggers ad display using the player built into the SDK.

  4. DestroyInterstitialAd / DestroyRewardedAd / DestroyBannerAd (optional): Destroys the ad container. You can work with multiple ad blocks simultaneously, but we strongly recommend destroying unnecessary ones to avoid memory and other issues.

  5. SetBannerCustomSettings (optional). Use this to customize settings for a banner 320x50.

  6. SetUserConsent (optional): Intended for conveying the user's consent status for the collection, processing, and use of personal data. By default, it is set to false, meaning the user has not given consent to the use of their data for advertising and other purposes. We recommend using this action to improve ad monetization quality.

Using Multiple Ad Units

You can work with multiple ad blocks asynchronously, meaning you can call actions with different placement_name and formats independently of each other using actions LoadInterstitialAd / LoadRewardedAd / LoadBannerAd asynchronously, i.e., loading multiple ad blocks simultaneously.

Tracking Ad Events

Madex SDK allows you to track events occurring with ads to use them for integrating ads into your application's logic.

To track events, you need to provide a class to work with.

Note that ad events work on any ad unit.

That is, if you call the loading of 2 ad units simultaneously, the loading event will work 2 times, once for each unit.

Examples of setting existing ad events.

  • IsInterstitialAdReady: Checks the loading status of the ad block.

    The condition returns true or false. If the answer is negative, attempting to show the ad will not lead to anything.

    Although using this method is optional, we strongly recommend checking the ad's loading status before attempting to display it.

  • OnInterstitialShowFailed: Call if there is an error in loading the ad.

  • OnInterstitialClosed: Call when the user closes the ad.

  • OnInterstitialLoaded: Call when the ad is loaded and ready to be displayed.

  • OnInterstitialLoadFailed: Call if there is an error in loading the ad.

  • OnInterstitialShown: Call when ad display begins.

Last updated