Static Interstitial

Interstitials are full-screen visuals that appear inside your application.

NEW: SDK version 7.0.0 supports zones. Please note, this release does not currently support cross promotion ad serving. To access our cross promotion features, please use SDK version 6.4.1

1. Load the interstitial

Navigate to the header file that you want the interstitial to appear in (e.g. MyViewController.h/ViewController.swift) and modify the top of the file to look like this:

Objective-C
Swift
#import <Tapdaq/Tapdaq.h>

@interface MyViewController : UIViewController <TapdaqDelegate, TDAdRequestDelegate>

The above code imports Tapdaq to the class, and declares that we will conform to the TapdaqDelegate and TDAdRequestDelegate protocol.

TapdaqDelegate is required to receive callbacks about Tapdaq SDK configurations state.

Please note that you only need to provide import statement once per header file.

Next, add the following command to the implementation file (e.g. MyViewController.m/ViewController.swift):

Objective-C
Swift
- (void)viewDidLoad {
    [super viewDidLoad];
    [[Tapdaq sharedSession] setDelegate:self];
}

Once this is done, the Tapdaq delegate method -didLoadConfig becomes available, implement it like so:

Objective-C
Swift
- (void)didLoadConfig {
    [[Tapdaq sharedSession] loadInterstitialForPlacementTag:@"my_interstitial_tag" delegate:self];
}

This delegate method is invoked when the Tapdaq SDK has finished loading it's config, and is ready to begin loading ads.

Delegate parameter must conform to TDAdRequestDelegate.

Ads should only be requested once the Tapdaq delegate method -didLoadConfig has been called. This ensures Tapdaq is initialised and ready to begin loading ads. Requesting ads prior to Tapdaq initialising will result in failed ad requests

2. Display the interstitial

Once that is done, implement the following:

Objective-C
Swift
- (void)didLoadAdRequest:(TDAdRequest *)adRequest {
    if ([adRequest isKindOfClass:[TDMediationAdRequest class]] && [adRequest.placement.tag isEqualToString:@"my_interstitial_tag"]) {
        if (adRequest.placement.adTypes & TDAdTypeInterstitial) {
            [(TDMediationAdRequest *)adRequest display];
        }
    }
}

The code above is executed when the interstitial has successfully loaded. For a full list of delegate methods we support, see our Callbacks page.

It is also possible to check the interstitial is loaded before displaying it to the user, as shown below:

Objective-C
Swift
if ([[Tapdaq sharedSession] isInterstitialReadyForPlacementTag:@"my_interstitial_tag"]) {
    [[Tapdaq sharedSession] showInterstitialForPlacementTag:@"my_interstitial_tag"];
}

3. Load another interstitial on close

If you wish to load another interstitial after you have shown one, implement one of the following options:

A. Auto Reload all Ads

To auto reload all ads using the same placement tag, set the global config before initializing, like so:

Objective-C
Swift
TDProperties *properties = [[TDProperties alloc] init];
[properties setAutoReloadAds:YES];

B. Implement the didCloseAdRequest: Delegate with the placement tag you'd like to reload

When loading an interstitial ad the delegate specified in the loadInterstitial can conform to TDDisplayableAdRequestDelegate which will allow it to handle didCloseAdRequest:.

Objective-C
Swift
- (void)didCloseAdRequest:(TDAdRequest *)adRequest {
    [[Tapdaq sharedSession] loadInterstitialForPlacementTag:adRequest.placement.tag delegate:self];
}

Build and run your application to test the advert displays correctly.

Need help?

If you are having any problems integrating, feel free to contact us on [email protected] and we will be more than happy to help.

What's next?

Now that you have successfully integrated an interstitial into your app, what would you like to do next?