Skip to content

Test Ads

Use the Unity Editor mock ads

To help you test your integration from the Unity Editor we have included mock or placeholder ads that mimic the behaviour of its native counterparts. This is useful to quickly test how your app flow works when showing ads and listening to the different callbacks, without having to build and run it on a physical device.

Once you finish testing your integration remember to run your app on a physical device, as these mock ads are only shown when launching the game using the Editor's play button.

Mock Banner Ad Mock Interstitial Ad Mock Rewarded Ad
Mock Banner Mock Interstitial Mock Rewarded

Request Test Ads

When testing on a native target (Android or iOS) you should request ads by setting the test flag to true when initializing XMediator. We use this flag to ask the underlying networks to provide us with test ads when possible.

Info

Some networks may not support this flag and might provide other means to test their integration so make sure to always check the ad network's documentation for any additional steps.

We do provide test Placement Ids to enable a quick way to test the integration.

Test Placement Ids
Placement Value
App key 3-15
Banner 3-15/28
Interstitial 3-15/26
Rewarded 3-15/27

Currently, these placements are only supported for Google Ads, AppLovin, Chartboost, Unity Ads and Liftoff Monetize.

Warning

Remember to replace these test placements with your own placements and setting the test flags to false before your app gets published

var shouldRequestTestAds = Debug.isDebugBuild;

// Initialize
XMediatorAds.StartWith(
    appKey: "3-15",
    initSettings: new InitSettings(
        test: shouldRequestTestAds,
        userProperties: new UserProperties(
            userId: "<your-user-id>"
        )
    ),
    initCallback: result =>
    {
        XMediatorAds.Banner.Create(placementId: "3-15/28", size: BannerAds.Size.Phone, position: BannerAds.Position.Top);
        XMediatorAds.Interstitial.Load(placementId: "3-15/26");
        XMediatorAds.Rewarded.Load(placementId: "3-15/27");
    }
);

Enable verbose logging

Setting the verbose flag to true will output extra logging information to Logcat on Android and to the standard output on iOS.

// Initialize
XMediatorAds.StartWith(
    appKey: "<your-app-key>",
    initSettings: new InitSettings(
        verbose: true,
        userProperties: new UserProperties(
            userId: "<your-user-id>"
        )
    )
);