Skip to main content

Getting Started

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

샘플 이미지

Prerequisites

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

class MyViewController : UIViewController, GFPInterstitialAdManagerDelegate {
private var adManager : GFPInterstitialAdManager?
}

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.

override func viewDidLoad() {
super.viewDidLoad()

let adParam = GFPAdParam()
adParam.yearOfBirth = 1990
adParam.gender = .male
...

self.adManager = GFPInterstitialAdManager(unitID: "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:

info

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)

GFPInterstitialAdManagerDelegate

Load Events

On Load Success

func interstitialAdManager(_ manager: GFPInterstitialAdManager, didLoad interstitialAd: GFPInterstitialAd) {
...
}

On Load Failure

func interstitialAdManager(_ manager: GFPInterstitialAdManager, didFailWithError error: GFPError, responseInfo: GFPLoadResponseInfo!) {
...
}

LifeCycle Events

On Start Showing Ad

func interstitialAdManager(_ manager: GFPInterstitialAdManager, didStart interstitialAd: GFPInterstitialAd) {
...
}

On Finish Showing Ad

func interstitialAdManager(_ manager: GFPInterstitialAdManager, didComplete interstitialAd: GFPInterstitialAd) {
...
}

On Dismiss

func interstitialAdManager(_ manager: GFPInterstitialAdManager, didClose interstitialAd: GFPInterstitialAd) {
...
}

On Click

func interstitialAdManager(_ manager: GFPInterstitialAdManager, wasClickedAd interstitialAd: GFPInterstitialAd) {
...
}
info

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