GoogleMobileAds Framework Reference
Stay organized with collections
Save and categorize content based on your preferences.
@protocol GADMediatedUnifiedNativeAd <NSObject>
Provides methods used for constructing native ads. The adapter must return an object conforming
to this protocol for native ad requests.
-
Declaration
Swift
var headline: String? { get }
Objective-C
@property (nonatomic, copy, readonly, nullable) NSString *headline;
-
Array of GADNativeAdImage objects.
Declaration
Swift
var images: [NativeAdImage]? { get }
Objective-C
@property (nonatomic, readonly, nullable) NSArray<GADNativeAdImage *> *images;
-
Declaration
Swift
var body: String? { get }
Objective-C
@property (nonatomic, copy, readonly, nullable) NSString *body;
-
Declaration
Swift
var icon: NativeAdImage? { get }
-
Text that encourages user to take some action with the ad. For example “Install”.
Declaration
Swift
var callToAction: String? { get }
Objective-C
@property (nonatomic, copy, readonly, nullable) NSString *callToAction;
-
App store rating (0 to 5).
Declaration
Swift
@NSCopying var starRating: NSDecimalNumber? { get }
Objective-C
@property (nonatomic, copy, readonly, nullable) NSDecimalNumber *starRating;
-
The app store name. For example, “App Store”.
Declaration
Swift
var store: String? { get }
Objective-C
@property (nonatomic, copy, readonly, nullable) NSString *store;
-
String representation of the app’s price.
Declaration
Swift
var price: String? { get }
Objective-C
@property (nonatomic, copy, readonly, nullable) NSString *price;
-
Identifies the advertiser. For example, the advertiser’s name or visible URL.
Declaration
Swift
var advertiser: String? { get }
Objective-C
@property (nonatomic, copy, readonly, nullable) NSString *advertiser;
-
Returns a dictionary of asset names and object pairs for assets that are not handled by
properties of the GADMediatedUnifiedNativeAd.
Declaration
Swift
var extraAssets: [String : Any]? { get }
Objective-C
@property (nonatomic, copy, readonly, nullable) NSDictionary<NSString *, id> *extraAssets;
-
Declaration
Swift
optional var adChoicesView: UIView? { get }
Objective-C
@optional
@property (nonatomic, readonly, nullable) UIView *adChoicesView;
-
Declaration
Swift
optional var mediaView: UIView? { get }
Objective-C
@optional
@property (nonatomic, readonly, nullable) UIView *mediaView;
-
Indicates whether the ad has video content.
Declaration
Swift
optional var hasVideoContent: Bool { get }
Objective-C
@optional
@property (nonatomic, readonly) BOOL hasVideoContent;
-
Media content aspect ratio (width/height) or 0 if there’s no media content.
Declaration
Swift
optional var mediaContentAspectRatio: CGFloat { get }
Objective-C
@optional
@property (nonatomic, readonly) CGFloat mediaContentAspectRatio;
-
The video’s duration in seconds or 0 if there’s no video or the duration is unknown.
Declaration
Swift
optional var duration: TimeInterval { get }
Objective-C
@optional
@property (nonatomic, readonly) NSTimeInterval duration;
-
The video’s current playback time in seconds or 0 if there’s no video or the current playback
time is unknown.
Declaration
Swift
optional var currentTime: TimeInterval { get }
Objective-C
@optional
@property (nonatomic, readonly) NSTimeInterval currentTime;
-
Tells the receiver that it has been rendered in |view| with clickable asset views and
nonclickable asset views. viewController should be used to present modal views for the ad.
Declaration
Objective-C
- (void)didRenderInView:(nonnull UIView *)view
clickableAssetViews:
(nonnull NSDictionary<GADNativeAssetIdentifier, UIView *> *)
clickableAssetViews
nonclickableAssetViews:
(nonnull NSDictionary<GADNativeAssetIdentifier, UIView *> *)
nonclickableAssetViews
viewController:(nonnull UIViewController *)viewController;
-
Tells the receiver that an impression is recorded. This method is called only once per mediated
native ad.
Declaration
Swift
optional func didRecordImpression()
Objective-C
- (void)didRecordImpression;
-
Tells the receiver that a user click is recorded on the asset named |assetName|. Full screen
actions should be presented from viewController. This method is called only if
-[GADMAdNetworkAdapter handlesUserClicks] returns NO.
Declaration
Swift
optional func didRecordClickOnAsset(with assetName: GADNativeAssetIdentifier, view: UIView, viewController: UIViewController)
Objective-C
- (void)
didRecordClickOnAssetWithName:(nonnull GADNativeAssetIdentifier)assetName
view:(nonnull UIView *)view
viewController:(nonnull UIViewController *)viewController;
-
Tells the receiver that it has untracked |view|. This method is called when the mediated native
ad is no longer rendered in the provided view and the delegate should stop tracking the view’s
impressions and clicks. The method may also be called with a nil view when the view in which the
mediated native ad has rendered is deallocated.
Declaration
Swift
optional func didUntrackView(_ view: UIView?)
Objective-C
- (void)didUntrackView:(nullable UIView *)view;
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-20 UTC.
[[["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\u003eThe \u003ccode\u003eGADMediatedUnifiedNativeAd\u003c/code\u003e protocol provides methods for constructing native ads within mediation adapters.\u003c/p\u003e\n"],["\u003cp\u003eAdapters must return an object conforming to this protocol to handle native ad requests.\u003c/p\u003e\n"],["\u003cp\u003eIt includes properties for essential native ad elements like headlines, images, body text, icons, call-to-actions, and more.\u003c/p\u003e\n"],["\u003cp\u003eIt offers methods to track ad rendering, impressions, clicks, and view untracking for reporting and interaction management.\u003c/p\u003e\n"],["\u003cp\u003eOptional properties and methods handle video content, ad choices, and custom assets for enhanced ad experiences.\u003c/p\u003e\n"]]],["The `GADMediatedUnifiedNativeAd` protocol defines methods for constructing native ads, requiring an object conforming to this protocol for native ad requests. It outlines properties like `headline`, `images`, `body`, `icon`, `callToAction`, `starRating`, `store`, `price`, `advertiser`, and `extraAssets`. Additionally it include methods like `didRenderInView`, `didRecordImpression`, `didRecordClickOnAssetWithName`, and `didUntrackView` for handling ad rendering, impressions, clicks, and view tracking. optional `hasVideoContent`, `mediaContentAspectRatio`, `duration`, `currentTime` are available for video related information.\n"],null,["GADMediatedUnifiedNativeAd \n\n @protocol GADMediatedUnifiedNativeAd \u003cNSObject\u003e\n\nProvides methods used for constructing native ads. The adapter must return an object conforming\nto this protocol for native ad requests.\n- `\n ``\n ``\n `\n\n [headline](#/c:objc(pl)GADMediatedUnifiedNativeAd(py)headline)`\n ` \n Headline. \n\n Declaration \n Swift \n\n var headline: String? { get }\n\n Objective-C \n\n @property (nonatomic, copy, readonly, nullable) NSString *headline;\n\n- `\n ``\n ``\n `\n\n [images](#/c:objc(pl)GADMediatedUnifiedNativeAd(py)images)`\n ` \n Array of GADNativeAdImage objects. \n\n Declaration \n Swift \n\n var images: [NativeAdImage]? { get }\n\n Objective-C \n\n @property (nonatomic, readonly, nullable) NSArray\u003c../Classes/GADNativeAdImage.html *\u003e *images;\n\n- `\n ``\n ``\n `\n\n [body](#/c:objc(pl)GADMediatedUnifiedNativeAd(py)body)`\n ` \n Description. \n\n Declaration \n Swift \n\n var body: String? { get }\n\n Objective-C \n\n @property (nonatomic, copy, readonly, nullable) NSString *body;\n\n- `\n ``\n ``\n `\n\n [icon](#/c:objc(pl)GADMediatedUnifiedNativeAd(py)icon)`\n ` \n Icon image. \n\n Declaration \n Swift \n\n var icon: NativeAdImage? { get }\n\n Objective-C \n\n @property (nonatomic, readonly, nullable) ../Classes/GADNativeAdImage.html *icon;\n\n- `\n ``\n ``\n `\n\n [callToAction](#/c:objc(pl)GADMediatedUnifiedNativeAd(py)callToAction)`\n ` \n Text that encourages user to take some action with the ad. For example \"Install\". \n\n Declaration \n Swift \n\n var callToAction: String? { get }\n\n Objective-C \n\n @property (nonatomic, copy, readonly, nullable) NSString *callToAction;\n\n- `\n ``\n ``\n `\n\n [starRating](#/c:objc(pl)GADMediatedUnifiedNativeAd(py)starRating)`\n ` \n App store rating (0 to 5). \n\n Declaration \n Swift \n\n @NSCopying var starRating: NSDecimalNumber? { get }\n\n Objective-C \n\n @property (nonatomic, copy, readonly, nullable) NSDecimalNumber *starRating;\n\n- `\n ``\n ``\n `\n\n [store](#/c:objc(pl)GADMediatedUnifiedNativeAd(py)store)`\n ` \n The app store name. For example, \"App Store\". \n\n Declaration \n Swift \n\n var store: String? { get }\n\n Objective-C \n\n @property (nonatomic, copy, readonly, nullable) NSString *store;\n\n- `\n ``\n ``\n `\n\n [price](#/c:objc(pl)GADMediatedUnifiedNativeAd(py)price)`\n ` \n String representation of the app's price. \n\n Declaration \n Swift \n\n var price: String? { get }\n\n Objective-C \n\n @property (nonatomic, copy, readonly, nullable) NSString *price;\n\n- `\n ``\n ``\n `\n\n [advertiser](#/c:objc(pl)GADMediatedUnifiedNativeAd(py)advertiser)`\n ` \n Identifies the advertiser. For example, the advertiser's name or visible URL. \n\n Declaration \n Swift \n\n var advertiser: String? { get }\n\n Objective-C \n\n @property (nonatomic, copy, readonly, nullable) NSString *advertiser;\n\n- `\n ``\n ``\n `\n\n [extraAssets](#/c:objc(pl)GADMediatedUnifiedNativeAd(py)extraAssets)`\n ` \n Returns a dictionary of asset names and object pairs for assets that are not handled by\n properties of the GADMediatedUnifiedNativeAd. \n\n Declaration \n Swift \n\n var extraAssets: [String : Any]? { get }\n\n Objective-C \n\n @property (nonatomic, copy, readonly, nullable) NSDictionary\u003cNSString *, id\u003e *extraAssets;\n\n- `\n ``\n ``\n `\n\n [adChoicesView](#/c:objc(pl)GADMediatedUnifiedNativeAd(py)adChoicesView)`\n ` \n AdChoices view. \n\n Declaration \n Swift \n\n optional var adChoicesView: UIView? { get }\n\n Objective-C \n\n @optional\n @property (nonatomic, readonly, nullable) UIView *adChoicesView;\n\n- `\n ``\n ``\n `\n\n [mediaView](#/c:objc(pl)GADMediatedUnifiedNativeAd(py)mediaView)`\n ` \n Media view. \n\n Declaration \n Swift \n\n optional var mediaView: UIView? { get }\n\n Objective-C \n\n @optional\n @property (nonatomic, readonly, nullable) UIView *mediaView;\n\n- `\n ``\n ``\n `\n\n [hasVideoContent](#/c:objc(pl)GADMediatedUnifiedNativeAd(py)hasVideoContent)`\n ` \n Indicates whether the ad has video content. \n\n Declaration \n Swift \n\n optional var hasVideoContent: Bool { get }\n\n Objective-C \n\n @optional\n @property (nonatomic, readonly) BOOL hasVideoContent;\n\n- `\n ``\n ``\n `\n\n [mediaContentAspectRatio](#/c:objc(pl)GADMediatedUnifiedNativeAd(py)mediaContentAspectRatio)`\n ` \n Media content aspect ratio (width/height) or 0 if there's no media content. \n\n Declaration \n Swift \n\n optional var mediaContentAspectRatio: CGFloat { get }\n\n Objective-C \n\n @optional\n @property (nonatomic, readonly) CGFloat mediaContentAspectRatio;\n\n- `\n ``\n ``\n `\n\n [duration](#/c:objc(pl)GADMediatedUnifiedNativeAd(py)duration)`\n ` \n The video's duration in seconds or 0 if there's no video or the duration is unknown. \n\n Declaration \n Swift \n\n optional var duration: TimeInterval { get }\n\n Objective-C \n\n @optional\n @property (nonatomic, readonly) NSTimeInterval duration;\n\n- `\n ``\n ``\n `\n\n [currentTime](#/c:objc(pl)GADMediatedUnifiedNativeAd(py)currentTime)`\n ` \n The video's current playback time in seconds or 0 if there's no video or the current playback\n time is unknown. \n\n Declaration \n Swift \n\n optional var currentTime: TimeInterval { get }\n\n Objective-C \n\n @optional\n @property (nonatomic, readonly) NSTimeInterval currentTime;\n\n- `\n ``\n ``\n `\n\n [-didRenderInView:clickableAssetViews:nonclickableAssetViews:viewController:](#/c:objc(pl)GADMediatedUnifiedNativeAd(im)didRenderInView:clickableAssetViews:nonclickableAssetViews:viewController:)`\n ` \n Tells the receiver that it has been rendered in \\|view\\| with clickable asset views and\n nonclickable asset views. viewController should be used to present modal views for the ad. \n\n Declaration \n Swift \n\n optional func didRender(in view: UIView, clickableAssetViews: [../Type-Definitions.html#/c:GADNativeAdAssetIdentifiers.h@T@GADNativeAssetIdentifier : UIView], nonclickableAssetViews: [../Type-Definitions.html#/c:GADNativeAdAssetIdentifiers.h@T@GADNativeAssetIdentifier : UIView], viewController: UIViewController)\n\n Objective-C \n\n - (void)didRenderInView:(nonnull UIView *)view\n clickableAssetViews:\n (nonnull NSDictionary\u003c../Type-Definitions.html#/c:GADNativeAdAssetIdentifiers.h@T@GADNativeAssetIdentifier, UIView *\u003e *)\n clickableAssetViews\n nonclickableAssetViews:\n (nonnull NSDictionary\u003c../Type-Definitions.html#/c:GADNativeAdAssetIdentifiers.h@T@GADNativeAssetIdentifier, UIView *\u003e *)\n nonclickableAssetViews\n viewController:(nonnull UIViewController *)viewController;\n\n- `\n ``\n ``\n `\n\n [-didRecordImpression](#/c:objc(pl)GADMediatedUnifiedNativeAd(im)didRecordImpression)`\n ` \n Tells the receiver that an impression is recorded. This method is called only once per mediated\n native ad. \n\n Declaration \n Swift \n\n optional func didRecordImpression()\n\n Objective-C \n\n - (void)didRecordImpression;\n\n- `\n ``\n ``\n `\n\n [-didRecordClickOnAssetWithName:view:viewController:](#/c:objc(pl)GADMediatedUnifiedNativeAd(im)didRecordClickOnAssetWithName:view:viewController:)`\n ` \n Tells the receiver that a user click is recorded on the asset named \\|assetName\\|. Full screen\n actions should be presented from viewController. This method is called only if\n -\\[GADMAdNetworkAdapter handlesUserClicks\\] returns NO. \n\n Declaration \n Swift \n\n optional func didRecordClickOnAsset(with assetName: ../Type-Definitions.html#/c:GADNativeAdAssetIdentifiers.h@T@GADNativeAssetIdentifier, view: UIView, viewController: UIViewController)\n\n Objective-C \n\n - (void)\n didRecordClickOnAssetWithName:(nonnull ../Type-Definitions.html#/c:GADNativeAdAssetIdentifiers.h@T@GADNativeAssetIdentifier)assetName\n view:(nonnull UIView *)view\n viewController:(nonnull UIViewController *)viewController;\n\n- `\n ``\n ``\n `\n\n [-didUntrackView:](#/c:objc(pl)GADMediatedUnifiedNativeAd(im)didUntrackView:)`\n ` \n Tells the receiver that it has untracked \\|view\\|. This method is called when the mediated native\n ad is no longer rendered in the provided view and the delegate should stop tracking the view's\n impressions and clicks. The method may also be called with a nil view when the view in which the\n mediated native ad has rendered is deallocated. \n\n Declaration \n Swift \n\n optional func didUntrackView(_ view: UIView?)\n\n Objective-C \n\n - (void)didUntrackView:(nullable UIView *)view;"]]