Stay organized with collections
Save and categorize content based on your preferences.
GADCustomNativeAd
@interface GADCustomNativeAd : NSObject
Custom native ad. To request this ad type, you need to pass
GADAdLoaderAdTypeCustomNative (see GADAdLoaderAdTypes.h) to the |adTypes| parameter
in GADAdLoader’s initializer method. If you request this ad type, your delegate must conform to
the GADCustomNativeAdLoaderDelegate protocol.
Custom click handler. Set this property only if this ad is configured with a custom click
action, otherwise set it to nil. If this property is set to a non-nil value, the ad’s built-in
click actions are ignored and |customClickHandler| is executed when a click on the asset is
received.
Reference to a root view controller that is used by the ad to present full screen content after
the user interacts with the ad. The root view controller is most commonly the view controller
displaying the ad.
Declaration
Swift
weak var rootViewController: UIViewController? { get set }
Call when the user clicks on the ad. Provide the asset key that best matches the asset the user
interacted with. If this ad is configured with a custom click action, ensure the receiver’s
customClickHandler property is set before calling this method.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-20 UTC."],[[["\u003cp\u003e\u003ccode\u003eGADCustomNativeAd\u003c/code\u003e is a custom native ad format that requires using \u003ccode\u003eGADAdLoaderAdTypeCustomNative\u003c/code\u003e and conforming to the \u003ccode\u003eGADCustomNativeAdLoaderDelegate\u003c/code\u003e protocol.\u003c/p\u003e\n"],["\u003cp\u003eIt provides access to ad assets (images, strings) using keys and allows handling clicks with either built-in or custom actions.\u003c/p\u003e\n"],["\u003cp\u003eThis ad format offers functionalities for recording impressions and displaying media content, and it allows for setting a custom click handler for tailored interactions.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can access ad metadata such as format ID, available asset keys, response information, and display ad measurement.\u003c/p\u003e\n"],["\u003cp\u003eA delegate can be assigned to receive state change notifications, and a root view controller is needed for presenting full-screen content.\u003c/p\u003e\n"]]],["GADCustomNativeAd represents a custom native ad, requiring `GADAdLoaderAdTypeCustomNative` during initialization. Key actions include retrieving data via `imageForKey:` and `stringForKey:`, and reporting user interactions with `performClickOnAssetWithKey:`. It also allows for a `customClickHandler` for custom click actions. Developers can track impressions using `recordImpression`. The ad contains a format ID, available asset keys, media content, display ad measurement, response info and can set a delegate and a root view controller.\n"],null,["GADCustomNativeAd \n\n\n @interface GADCustomNativeAd : NSObject\n\nCustom native ad. To request this ad type, you need to pass\nGADAdLoaderAdTypeCustomNative (see GADAdLoaderAdTypes.h) to the \\|adTypes\\| parameter\nin GADAdLoader's initializer method. If you request this ad type, your delegate must conform to\nthe GADCustomNativeAdLoaderDelegate protocol.\n- `\n ``\n ``\n `\n\n [formatID](#/c:objc(cs)GADCustomNativeAd(py)formatID)`\n ` \n The ad's format ID. \n\n Declaration \n Swift \n\n var formatID: String { get }\n\n Objective-C \n\n @property (nonatomic, readonly, nonnull) NSString *formatID;\n\n- `\n ``\n ``\n `\n\n [availableAssetKeys](#/c:objc(cs)GADCustomNativeAd(py)availableAssetKeys)`\n ` \n Array of available asset keys. \n\n Declaration \n Swift \n\n var availableAssetKeys: [String] { get }\n\n Objective-C \n\n @property (nonatomic, readonly, nonnull) NSArray\u003cNSString *\u003e *availableAssetKeys;\n\n- `\n ``\n ``\n `\n\n [customClickHandler](#/c:objc(cs)GADCustomNativeAd(py)customClickHandler)`\n ` \n Custom click handler. Set this property only if this ad is configured with a custom click\n action, otherwise set it to nil. If this property is set to a non-nil value, the ad's built-in\n click actions are ignored and \\|customClickHandler\\| is executed when a click on the asset is\n received. \n\n Declaration \n Swift \n\n var customClickHandler: ../Type-Definitions.html#/c:GADCustomNativeAd.h@T@GADNativeAdCustomClickHandler? { get set }\n\n Objective-C \n\n @property (copy, nullable) ../Type-Definitions.html#/c:GADCustomNativeAd.h@T@GADNativeAdCustomClickHandler customClickHandler;\n\n- `\n ``\n ``\n `\n\n [displayAdMeasurement](#/c:objc(cs)GADCustomNativeAd(py)displayAdMeasurement)`\n ` \n The display ad measurement associated with this ad. \n\n Declaration \n Swift \n\n var displayAdMeasurement: DisplayAdMeasurement? { get }\n\n Objective-C \n\n @property (nonatomic, readonly, nullable) ../Classes/GADDisplayAdMeasurement.html *displayAdMeasurement;\n\n- `\n ``\n ``\n `\n\n [mediaContent](#/c:objc(cs)GADCustomNativeAd(py)mediaContent)`\n ` \n Media content. \n\n Declaration \n Swift \n\n var mediaContent: MediaContent { get }\n\n Objective-C \n\n @property (nonatomic, readonly, nonnull) ../Classes/GADMediaContent.html *mediaContent;\n\n- `\n ``\n ``\n `\n\n [delegate](#/c:objc(cs)GADCustomNativeAd(py)delegate)`\n ` \n Optional delegate to receive state change notifications. \n\n Declaration \n Swift \n\n weak var delegate: (any ../Protocols/GADCustomNativeAdDelegate.html)? { get set }\n\n Objective-C \n\n @property (nonatomic, weak, nullable) id\u003c../Protocols/GADCustomNativeAdDelegate.html\u003e delegate;\n\n- `\n ``\n ``\n `\n\n [rootViewController](#/c:objc(cs)GADCustomNativeAd(py)rootViewController)`\n ` \n Reference to a root view controller that is used by the ad to present full screen content after\n the user interacts with the ad. The root view controller is most commonly the view controller\n displaying the ad. \n\n Declaration \n Swift \n\n weak var rootViewController: UIViewController? { get set }\n\n Objective-C \n\n @property (nonatomic, weak, nullable) UIViewController *rootViewController;\n\n- `\n ``\n ``\n `\n\n [responseInfo](#/c:objc(cs)GADCustomNativeAd(py)responseInfo)`\n ` \n Information about the ad response that returned the ad. \n\n Declaration \n Swift \n\n var responseInfo: ResponseInfo { get }\n\n Objective-C \n\n @property (nonatomic, readonly, nonnull) ../Classes/GADResponseInfo.html *responseInfo;\n\n- `\n ``\n ``\n `\n\n [-imageForKey:](#/c:objc(cs)GADCustomNativeAd(im)imageForKey:)`\n ` \n Returns the native ad image corresponding to the specified key or nil if the image is not\n available. \n\n Declaration \n Swift \n\n func image(forKey key: String) -\u003e NativeAdImage?\n\n Objective-C \n\n - (nullable ../Classes/GADNativeAdImage.html *)imageForKey:(nonnull NSString *)key;\n\n- `\n ``\n ``\n `\n\n [-stringForKey:](#/c:objc(cs)GADCustomNativeAd(im)stringForKey:)`\n ` \n Returns the string corresponding to the specified key or nil if the string is not available. \n\n Declaration \n Swift \n\n func string(forKey key: String) -\u003e String?\n\n Objective-C \n\n - (nullable NSString *)stringForKey:(nonnull NSString *)key;\n\n- `\n ``\n ``\n `\n\n [-performClickOnAssetWithKey:](#/c:objc(cs)GADCustomNativeAd(im)performClickOnAssetWithKey:)`\n ` \n Call when the user clicks on the ad. Provide the asset key that best matches the asset the user\n interacted with. If this ad is configured with a custom click action, ensure the receiver's\n customClickHandler property is set before calling this method. \n\n Declaration \n Swift \n\n func performClickOnAsset(withKey assetKey: String)\n\n Objective-C \n\n - (void)performClickOnAssetWithKey:(nonnull NSString *)assetKey;\n\n- `\n ``\n ``\n `\n\n [-recordImpression](#/c:objc(cs)GADCustomNativeAd(im)recordImpression)`\n ` \n Call when the ad is displayed on screen to the user. Can be called multiple times. Only the\n first impression is recorded. \n\n Declaration \n Swift \n\n func recordImpression()\n\n Objective-C \n\n - (void)recordImpression;"]]