AI-generated Key Takeaways
-
GADCustomNativeAdDelegate
helps identify native ad assets and provides lifecycle event callbacks. -
It includes methods to track impressions and clicks on custom native ads.
-
Developers can use it to manage the presentation and dismissal of full-screen views triggered by ad interactions.
-
The delegate provides notifications for key ad lifecycle events, such as impression recording, click recording, and screen presentation changes, enabling developers to respond to these events.
-
These optional methods give developers control over ad behavior and user experience during ad interactions, allowing them to pause or resume app functionalities based on the ad's state.
GADCustomNativeAdDelegate
@protocol GADCustomNativeAdDelegate <NSObject>
Identifies native ad assets.
-
Called when an impression is recorded for a custom native ad.
Declaration
Swift
optional func customNativeAdDidRecordImpression(_ nativeAd: GADCustomNativeAd)
Objective-C
- (void)customNativeAdDidRecordImpression:(nonnull GADCustomNativeAd *)nativeAd;
-
Called when a click is recorded for a custom native ad.
Declaration
Swift
optional func customNativeAdDidRecordClick(_ nativeAd: GADCustomNativeAd)
Objective-C
- (void)customNativeAdDidRecordClick:(nonnull GADCustomNativeAd *)nativeAd;
-
Called just before presenting the user a full screen view, such as a browser, in response to clicking on an ad. Use this opportunity to stop animations, time sensitive interactions, etc.
Normally the user looks at the ad, dismisses it, and control returns to your application with the customNativeAdDidDismissScreen: message. However, if the user hits the Home button or clicks on an App Store link, your application will end. The next method called will be the applicationWillResignActive: of your UIApplicationDelegate object.
Declaration
Swift
@MainActor optional func customNativeAdWillPresentScreen(_ nativeAd: GADCustomNativeAd)
Objective-C
- (void)customNativeAdWillPresentScreen:(nonnull GADCustomNativeAd *)nativeAd;
-
Called just before dismissing a full screen view.
Declaration
Swift
@MainActor optional func customNativeAdWillDismissScreen(_ nativeAd: GADCustomNativeAd)
Objective-C
- (void)customNativeAdWillDismissScreen:(nonnull GADCustomNativeAd *)nativeAd;
-
Called just after dismissing a full screen view. Use this opportunity to restart anything you may have stopped as part of customNativeAdWillPresentScreen:.
Declaration
Swift
@MainActor optional func customNativeAdDidDismissScreen(_ nativeAd: GADCustomNativeAd)
Objective-C
- (void)customNativeAdDidDismissScreen:(nonnull GADCustomNativeAd *)nativeAd;