🖥️Interstitial Ad
To receive Interstitial Ads, you need to conform to the MediationAdDelegate protocol. Once the ad is loaded, it can be presented by calling presentInterstitial(from:).
Implementation:
extension InterstitialAdManager: MediationAdDelegate {
func onInterstitialAdLoaded(interstitialAd: AdsFramework.MediationInterstitialAd) {
interstitialAd.presentInterstitial(from: self)
interstitialAd.eventDelegate = self
}
func onAdFailedToLoad(error: AdsFramework.AdError) {
print("Interstitial Ad request failed with reason \(error.description)")
}
}Tracking Events:
To track click, impression, and fullscreen events, conform to MediationInterstitialAdEventDelegate:
extension InterstitialAdManager: MediationInterstitialAdEventDelegate {
func recordInterstitialClick() {
print("Interstitial clicked")
}
func recordInterstitialImpression() {
print("Interstitial impression recorded")
}
func ad(didFailToPresentFullScreenContentWithError error: AdsFramework.AdError) {
print("Interstitial failed to present: \(error.description)")
}
func adWillPresentFullScreenContent() {
print("Interstitial will present full screen content")
}
func adDidDismissFullScreenContent() {
print("Interstitial dismissed full screen content")
}
}Last updated