Getting Started
Interstitial ads are full-screen ads that cover the entire display area.

Prerequisites
Adding Dependencies
To use interstitial ads, add the GFPSDK/MediationNDARich module to your Podfile.
# When using static library
pod 'GFPSDK/MediationNDARich'
# When using dynamic library
pod 'GFPSDK-Dynamic/MediationNDARich'
NAMSDK Import
Import the SDK module.
- Swift
- Objective-C
import GFPSDK
@import GFPSDK;
Initializing Interstitial Ad Providers
With the Pod for the interstitial ad provider you want to integrate added to your project, initialize via GFPAdManager. (Perform this only once when the app starts.)
| Provider Option | Ad Provider | CocoaPods |
|---|---|---|
| GFPInterstitialAdProviderOptionNDA | Naver NDA | pod 'GFPSDK/MediationNDA' |
| GFPInterstitialAdProviderOptionDFP | Google GAM (Google Ad Manager) | pod 'GFPSDKMediationDFP' |
| GFPInterstitialAdProviderOptionFAN | Meta Audience Network | pod 'GFPSDKMediationFAN' |
| GFPInterstitialAdProviderOptionUnity | Unity Ads | pod 'GFPSDKMediationUnity' |
| GFPInterstitialAdProviderOptionAppLovin | AppLovin MAX | pod 'GFPSDKMediationAppLovin' |
| GFPInterstitialAdProviderOptionVungle | Liftoff (Vungle) | pod 'GFPSDKMediationVungle' |
| GFPInterstitialAdProviderOptionDT | Digital Turbine | pod 'GFPSDKMediationDT' |
| GFPInterstitialAdProviderOptionIS | IronSource | pod 'GFPSDKMediationIronSource' |
| GFPInterstitialAdProviderOptionLAN | LINE Ads Network | pod 'GFPSDKMediationLAN' |
| GFPInterstitialAdProviderOptionChartBoost | Chartboost | pod 'GFPSDKMediationChartBoost' |
| GFPInterstitialAdProviderOptionBidMachine | BidMachine | pod 'GFPSDKMediationBidMachine' |
| GFPInterstitialAdProviderOptionPangle | Pangle | pod 'GFPSDKMediationPangle' |
S2S interstitial ads do not require separate provider initialization.
- Swift
- Objective-C
// Add cocoapods dependencies if integrating DFP, Facebook interstitial ads.
GFPAdManager.setup(withPublisherCd: "publisherCd") { (error : GFPError?) in
print("Setup Eror: \(String(describing: error?.description))")
}
// Add cocoapods dependencies if integrating DFP, Facebook interstitial ads.
[GFPAdManager setupWithPublisherCd:@"publisherCd" completionHandler:^(GFPError * _Nullable error) {
NSLog(@"Setup ERROR: %@", error);
}];
For details on configuring GFPAdManager, refer to Ad Manager Setup.
Implementing a View Controller
Create a view controller (MyViewController) and perform the following steps in the header file (MyViewController.h).
(In this example, the view controller owns the manager.)
- Declare a *GFPInterstitialAdManager adManager property in the view controller.
- Implement the GFPInterstitialAdManagerDelegate protocol in the view controller.
GFPInterstitialAdManagerDelegate delivers the load status, failure status, and click events of interstitial ads.
- Swift
- Objective-C
// MyViewController.h
import GFPSDK
class MyViewController : UIViewController, GFPInterstitialAdManagerDelegate {
private var adManager : GFPInterstitialAdManager?
}
// MyViewController.h
@import GFPSDK;
@interface MyViewController : UIViewController <GFPInterstitialAdManagerDelegate>
@property (nonatomic) GFPInterstitialAdManager *adManager;
@end
GFPInterstitialAdManager Usage Guide
Creating GFPInterstitialAdManager and Requesting an Ad Load
In the viewDidLoad method of MyViewController.m, create an instance of GFPInterstitialAdManager and request an ad.
- After creating the instance, make sure to set the delegate.
- When creating a GFPInterstitialAdManager instance, provide the Ad Unit ID you received along with user information in GFPAdParam. GFPAdParam is used for targeting to improve ad performance.
- Swift
- Objective-C
override func viewDidLoad() {
super.viewDidLoad()
let adParam = GFPAdParam()
adParam.yearOfBirth = 1990
adParam.gender = .male
...
//Create instance
self.adManager = GFPInterstitialAdManager(unitID: "UnitID", adParam: adParam)
//Delegate
self.adManager?.delegate = self
//Timeout
self.adManager?.requestTimeoutInterval = 60
//Request ad
self.adManager?.load()
}
- (void)viewDidLoad {
[super viewDidLoad];
GFPAdParam *adParam = [[GFPAdParam alloc]init];
adParam.yearOfBirth = 1990;
adParam.gender = GFPAdParamGenderTypeMale;
...
//Create instance
self.adManager = [[GFPInterstitialAdManager alloc] initWithUnitID:@"UnitID" adParam:adParam];
//Delegate
self.adManager.delegate = self;
//Timeout
self.adManager.requestTimeoutInterval = 60;
//Request ad
[self.adManager load];
}
This manager is designed for one-time use per ad load and response. When loading a new ad, create a new manager instance.
When an ad request succeeds, the GFPInterstitialAdManagerDelegate interstitialAdManager:didLoadAd: method is called.
Requesting Ad Display
If you receive a success response via GFPInterstitialAdManagerDelegate interstitialAdManager:didLoadAd:,
you can request ad display using the show:(UIViewController *) method.
Checking if Ad is Loaded
You can use the isAdLoaded property to check whether an ad has been loaded.
- Swift
- Objective-C
if self.adManager?.isAdLoaded == true {
// The ad is in a loaded state.
}
if (self.adManager.isAdLoaded) {
// The ad is in a loaded state.
}
Checking for Ad Invalidation
When displaying a preloaded and cached ad, you must use the isAdInvalidate method to check whether the ad has expired. If you display an expired ad, you will not receive compensation for the ad impression.
- Swift
- Objective-C
if interstitialdAd.isAdInvalidate {
self.adManager?.show(self)
}
if (interstitialdAd.isAdInvalidate) {
[self.adManager show:self];
}
When requesting ad display, if the display fails, the GFPInterstitialAdManagerDelegate interstitialAdManager:didFailWithError:responseInfo: method is called.
Since ad loading and ad display are separate, you can implement a flow where you load first and then display later. The validity period of a loaded ad is DFP, FAN: 60 minutes.
GFPInterstitialAdManagerDelegate
By implementing GFPInterstitialAdManagerDelegate, you can receive interstitial ad events through the corresponding methods.
Load Events
On Load Success
- Swift
- Objective-C
func interstitialAdManager(_ manager: GFPInterstitialAdManager, didLoad interstitialAd: GFPInterstitialAd) {
...
}
- (void)interstitialAdManager:(nonnull GFPInterstitialAdManager *)manager didLoadAd:(nonnull GFPInterstitialAd *)interstitialAd {
...
}
On Load Failure
- Swift
- Objective-C
func interstitialAdManager(_ manager: GFPInterstitialAdManager, didFailWithError error: GFPError, responseInfo: GFPLoadResponseInfo!) {
...
}
- (void)interstitialAdManager:(nonnull GFPInterstitialAdManager *)manager didFailWithError:(nonnull GFPError *)error responseInfo:(nullable GFPLoadResponseInfo *)responseInfo {
...
}
Not only load failures, but also display failures, expiration, and other failure events are all delivered through this method.
LifeCycle Event
On Ad View Start
- Swift
- Objective-C
func interstitialAdManager(_ manager: GFPInterstitialAdManager, didStart interstitialAd: GFPInterstitialAd) {
...
}
- (void)interstitialAdManager:(nonnull GFPInterstitialAdManager *)manager didStartAd:(nonnull GFPInterstitialAd *)interstitialAd {
...
}
On Ad View Complete
- Swift
- Objective-C
func interstitialAdManager(_ manager: GFPInterstitialAdManager, didComplete interstitialAd: GFPInterstitialAd) {
...
}
- (void)interstitialAdManager:(nonnull GFPInterstitialAdManager *)manager didCompleteAd:(nonnull GFPInterstitialAd *)interstitialAd {
...
}
On Ad View Dismissed
- Swift
- Objective-C
func interstitialAdManager(_ manager: GFPInterstitialAdManager, didClose interstitialAd: GFPInterstitialAd) {
...
}
- (void)interstitialAdManager:(nonnull GFPInterstitialAdManager *)manager didCloseAd:(nonnull GFPInterstitialAd *)interstitialAd {
...
}
On Ad Clicked
- Swift
- Objective-C
func interstitialAdManager(_ manager: GFPInterstitialAdManager, wasClickedAd interstitialAd: GFPInterstitialAd) {
...
}
- (void)interstitialAdManager:(nonnull GFPInterstitialAdManager *)manager wasClickedAd:(nonnull GFPInterstitialAd *)interstitialAd {
...
}
DFP version 7.x.x does not support click events, so this event will not be delivered.
The following methods are @optional delegate methods. You can implement them selectively as needed.
On Ad Impression
- Swift
- Objective-C
func interstitialAdManagerDidReceiveImpression(_ manager: GFPInterstitialAdManager) { ... }
- (void)interstitialAdManagerDidReceiveImpression:(nonnull GFPInterstitialAdManager *)manager { ... }
On In-App Browser Opened
- Swift
- Objective-C
func interstitialAdManagerDidPresentDefaultInAppBrowser(_ manager: GFPInterstitialAdManager) { ... }
- (void)interstitialAdManagerDidPresentDefaultInAppBrowser:(nonnull GFPInterstitialAdManager *)manager { ... }
On In-App Browser Closed
- Swift
- Objective-C
func interstitialAdManagerDidDismissDefaultInAppBrowser(_ manager: GFPInterstitialAdManager) { ... }
- (void)interstitialAdManagerDidDismissDefaultInAppBrowser:(nonnull GFPInterstitialAdManager *)manager { ... }