Skip to content

5 - Test your integration with test Ads

Once the ads are integrated into the application, it is necessary to test that the integration is correct. For this purpose, X3M provides the capability to receive test ads from pre-configured placements.

Request Test Ads

When testing you should request ads by setting the test flag to true when initializing XMediator and when creating ad instances. We use this flag to ask the underlying networks to provide us with test ads when possible.

Info

Some mediation services (or their underlying networks) may not support this flag and might provide other means to test their integration, so make sure to always check their documentation for any additional steps.

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

Test Placement Ids
Placement X3M MAX Mediation LevelPlay Mediation
App key 3-15 3-180 3-181
Banner 3-15/28 3-180/1150 3-181/1153
Interstitial 3-15/26 3-180/1151 3-181/1154
Rewarded 3-15/27 3-180/1152 3-181/1155

Warning

Remember to replace these test placements with your own placements and always set the test flags to false in a production environment

Enable test mode

Set the test flag to true to see test ads when available.

import XMediator

#if DEBUG
    let shouldRequestTestAds = true
#else
    let shouldRequestTestAds = false
#endif

// Initialize
let initSettings = InitSettings(test: shouldRequestTestAds)
XMediatorAds.startWith(appKey: "3-15",
                       initSettings: initSettings) { result in
    XMediatorAds.banner.create(placementId: "3-15/28", size: .phone, viewController: self)
    XMediatorAds.interstitial.load(placementId: "3-15/26")
    XMediatorAds.rewarded.load(placementId: "3-15/27")
}
@import XMediatorObjC;

#if DEBUG
    BOOL shouldRequestTestAds = YES;
#else
    BOOL shouldRequestTestAds = NO;
#endif

X3MInitSettings *initSettings = [X3MInitSettings new];
initSettings.test = shouldRequestTestAds;

[X3MXMediatorAds startWithAppKey:@"3-15"
                    initSettings:initSettings
                        callback:^(NSError * _Nullable error) {
    [X3MXMediatorAds.banner createWithPlacementId:@"3-15/28" size:X3MBannerSizePhone viewController:self];
    [X3MXMediatorAds.interstitial loadWithPlacementId:@"3-15/26"];
    [X3MXMediatorAds.rewarded loadWithPlacementId:@"3-15/27"];
}];

Enable verbose logging

Setting the verbose flag to true will output extra logging information to the standard output.

let initSettings = InitSettings(verbose: true)
XMediatorAds.startWith(appKey: "3-15",
                       initSettings: initSettings) { _ in
    // [...]
}
X3MInitSettings *initSettings = [X3MInitSettings new];
initSettings.verbose = YES;

[X3MXMediatorAds startWithAppKey:@"3-15"
                    initSettings:initSettings
                        callback:^(NSError * _Nullable error) {
    // [...]
}];