GADMediatedNativeAdDelegate

@protocol GADMediatedNativeAdDelegate <NSObject>

GADMediatedNativeAdDelegate objects handle mediated native ad events.

  • Tells the delegate that the mediated native ad has rendered in |view| with clickable asset views and nonclickable asset views. viewController should be used to present modal views if the ad opens full screen.

    Declaration

    Swift

    optional func mediatedNativeAd(_ mediatedNativeAd: GADMediatedNativeAd, didRenderIn view: UIView, clickableAssetViews: [String : UIView], nonclickableAssetViews: [String : UIView], viewController: UIViewController)

    Objective-C

    - (void)mediatedNativeAd:(nonnull id<GADMediatedNativeAd>)mediatedNativeAd
               didRenderInView:(nonnull UIView *)view
           clickableAssetViews:
               (nonnull NSDictionary<NSString *, UIView *> *)clickableAssetViews
        nonclickableAssetViews:
            (nonnull NSDictionary<NSString *, UIView *> *)nonclickableAssetViews
                viewController:(nonnull UIViewController *)viewController;
  • Tells the delegate that the mediated native ad has recorded an impression. This method is called only once per mediated native ad.

    Declaration

    Swift

    optional func mediatedNativeAdDidRecordImpression(_ mediatedNativeAd: GADMediatedNativeAd)

    Objective-C

    - (void)mediatedNativeAdDidRecordImpression:
        (nonnull id<GADMediatedNativeAd>)mediatedNativeAd;
  • Tells the delegate that the mediated native ad has recorded a user click 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 mediatedNativeAd(_ mediatedNativeAd: GADMediatedNativeAd, didRecordClickOnAssetWithName assetName: String, view: UIView, viewController: UIViewController)

    Objective-C

    - (void)mediatedNativeAd:(nonnull id<GADMediatedNativeAd>)mediatedNativeAd
        didRecordClickOnAssetWithName:(nonnull NSString *)assetName
                                 view:(nonnull UIView *)view
                       viewController:(nonnull UIViewController *)viewController;
  • Tells the delegate that the mediated native ad has untracked |view|. This method is called when the mediatedNativeAd 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 mediatedNativeAd(_ mediatedNativeAd: GADMediatedNativeAd, didUntrackView view: UIView?)

    Objective-C

    - (void)mediatedNativeAd:(nonnull id<GADMediatedNativeAd>)mediatedNativeAd
              didUntrackView:(nullable UIView *)view;
  • Tells the delegate that the mediated native ad has rendered in |view|. viewController should be used to present modal views for the ad.

    Declaration

    Swift

    optional func mediatedNativeAd(_ mediatedNativeAd: GADMediatedNativeAd, didRenderIn view: UIView, viewController: UIViewController)

    Objective-C

    - (void)mediatedNativeAd:(nonnull id<GADMediatedNativeAd>)mediatedNativeAd
             didRenderInView:(nonnull UIView *)view
              viewController:(nonnull UIViewController *)viewController;