Skip to main content

Interstitial Ads

Interstitial ads are full-screened image or video ads that draw full attention of users.

Implementing View Controller

In the view controller that will present the ad view as subview,

  • add this property

    GFPInterstitialAdManager *adManager

  • and implement this delegate protocol

    GFPInterstitialAdManagerDelegate

// MyViewController.h

@import GFPSDK;

@interface MyViewController : UIViewController <GFPInterstitialAdManagerDelegate>

@property (nonatomic) GFPInterstitialAdManager *adManager;

@end

GFPInterstitialAdManager

Initializing GFPInterstitialAdManager

Initialize GFPInterstitialAdManager in your view controller, say, in viewDidLoad:.

  • Provide GFPInterstitialAdManager with video ad Ad Unit ID (essential) and GFPAdParam (optional) for better ad performance.

  • Make sure to set GFPInterstitialAdManagerDelegate on GFPInterstitialAdManager

danger

Use GFPInterstitialAdManager instance for only single ad request, than create another for the next ad request. It is designed to manage the life cycle of only single ad.

- (void)viewDidLoad {
[super viewDidLoad];

GFPAdParam *adParam = [[GFPAdParam alloc]init];
adParam.yearOfBirth = 1990;
adParam.gender = GFPAdParamGenderTypeMale;
...

self.adManager = [[GFPInterstitialAdManager alloc] initWithUnitID:@"UnitID" adParam:adParam];
self.adManager.delegate = self;
self.adManager.requestTimeoutInterval = 60;
}

Loading Ad

danger

Since AppLovin and IronSource runs on a singleton to for loading ads, you can preload only one ad at a time, per Ad Unit ID.

[self.adManager load];

Showing Ad

On succefully loading ad, GFPInterstitialAdManagerDelegate provides ad through interstitialAdManager:didLoadAd:.

Than show the interstitial ad at the desired moment, using GFPInterstitialAdManager show:

Loaded ads don't have to be shown as soon as being loaded. Thus, preload ads for app's performance.

Be mindful, though, that loaded ads are valid for a only limited time. ex) for DFP, FAN: 60 mins.

[self.adManager show:self];

Additional Configurations

Ad Request Timeout (per GFPInterstitialAdManager)

Set timeout (seconds) for ad requests. GFPInterstitialAdManager will call interstitialAdManager:didFailWithError:responseInfo: on timeout. Default is 60 seconds.

self.adManager.requestTimeoutInterval = ...

Ad Request Timeout (global configuration on GFPAdManager)

Set global interstitial timeout (seconds) for ad requests. GFPInterstitialAdManager will call interstitialAdManager:didFailWithError:responseInfo: on timeout. Default is 60 seconds.

[GFPAdManager adConfiguration].interstitialAdRequestTimeout = ...

GFPInterstitialAdManagerDelegate

Load Events

On Load Success

- (void)interstitialAdManager:(nonnull GFPInterstitialAdManager *)manager didLoadAd:(nonnull GFPInterstitialAd *)interstitialAd {
...
}

On Load Failure

- (void)interstitialAdManager:(nonnull GFPInterstitialAdManager *)manager didFailWithError:(nonnull GFPError *)error responseInfo:(nullable GFPLoadResponseInfo *)responseInfo {
...
}

LifeCycle Events

On Start Showing Ad

- (void)interstitialAdManager:(nonnull GFPInterstitialAdManager *)manager didStartAd:(nonnull GFPInterstitialAd *)interstitialAd {
...
}

On Finish Showing Ad

- (void)interstitialAdManager:(nonnull GFPInterstitialAdManager *)manager didCompleteAd:(nonnull GFPInterstitialAd *)interstitialAd {
...
}

On Dismiss

- (void)interstitialAdManager:(nonnull GFPInterstitialAdManager *)manager didCloseAd:(nonnull GFPInterstitialAd *)interstitialAd {
...
}

On Click

- (void)interstitialAdManager:(nonnull GFPInterstitialAdManager *)manager wasClickedAd:(nonnull GFPInterstitialAd *)interstitialAd {
...
}

info

For Google DFP = 7.X.X click events are not supported.