رویدادهای سفارشی تبلیغات بومی

پیش نیازها

راه اندازی رویدادهای سفارشی را کامل کنید.

درخواست آگهی بومی

هنگامی که مورد خط رویداد سفارشی در زنجیره واسطه آبشار به دست می‌آید،the loadNativeAd:adConfiguration:completionHandler: method با نام کلاسی که هنگام ایجاد یک رویداد سفارشی ارائه کرده‌اید فراخوانی می‌شود. در این مورد، آن متد در SampleCustomEvent است، که سپسthe loadNativeAd:adConfiguration:completionHandler: method در SampleCustomEventNativeفراخوانی می کند.

برای درخواست یک تبلیغ بومی، کلاسی را ایجاد یا تغییر دهید که GADMediationAdapter و loadNativeAd:adConfiguration:completionHandler: اجرا می کند. اگر کلاسی که GADMediationAdapter را گسترش می‌دهد از قبل وجود دارد، loadNativeAd:adConfiguration:completionHandler: در آنجا پیاده‌سازی کنید. علاوه بر این، یک کلاس جدید برای پیاده سازی GADMediationNativeAd ایجاد کنید.

در مثال رویداد سفارشی ما، SampleCustomEventthe GADMediationAdapter interface را پیاده سازی می کند و سپس بهSampleCustomEventNativeواگذار می کند.

سریع

import GoogleMobileAds

class SampleCustomEvent: NSObject, GADMediationAdapter {

  fileprivate var nativeAd: SampleCustomEventNativeAd?

  func loadNativeAd(
    for adConfiguration: GADMediationNativeAdConfiguration,
    completionHandler: @escaping GADMediationNativeAdLoadCompletionHandler
  ) {
    self.nativeAd = SampleCustomEventNativeAd()
    self.nativeAd?.loadNativeAd(
      for: adConfiguration, completionHandler: completionHandler)
  }
}

هدف-C

#import "SampleCustomEvent.h"

@implementation SampleCustomEvent

SampleCustomEventNativeAd *sampleNativeAd;

- (void)loadNativeAdForAdConfiguration:
            (GADMediationNativeAdConfiguration *)adConfiguration
                     completionHandler:
                         (GADMediationNativeAdLoadCompletionHandler)
                             completionHandler {
  sampleNative = [[SampleCustomEventNativeAd alloc] init];
  [sampleNative loadNativeAdForAdConfiguration:adConfiguration
                             completionHandler:completionHandler];
}

SampleCustomEventNative مسئول وظایف زیر است:

  • در حال بارگیری آگهی بومی

  • پیاده سازی GADMediationNativeAd protocol

  • دریافت و گزارش تماس‌های رویداد تبلیغاتی به Google Mobile Ads SDK

پارامتر اختیاری تعریف شده در رابط کاربری AdMob در پیکربندی آگهی گنجانده شده است. این پارامتر از طریق adConfiguration.credentials.settings[@"parameter"] قابل دسترسی است. این پارامتر معمولاً یک شناسه واحد تبلیغاتی است که یک SDK شبکه تبلیغاتی هنگام نمونه‌برداری از یک شی تبلیغاتی به آن نیاز دارد.

سریع

class SampleCustomEventNativeAd: NSObject, GADMediationNativeAd {
  /// The Sample Ad Network native ad.
  var nativeAd: SampleNativeAd?

  /// The ad event delegate to forward ad rendering events to the Google Mobile
  /// Ads SDK.
  var delegate: GADMediationNativeAdEventDelegate?

  /// Completion handler called after ad load
  var completionHandler: GADMediationNativeLoadCompletionHandler?

  func loadNativeAd(
    for adConfiguration: GADMediationNativeAdConfiguration,
    completionHandler: @escaping GADMediationNativeLoadCompletionHandler
  ) {
    let adLoader = SampleNativeAdLoader()
    let sampleRequest = SampleNativeAdRequest()

    // The Google Mobile Ads SDK requires the image assets to be downloaded
    // automatically unless the publisher specifies otherwise by using the
    // GADNativeAdImageAdLoaderOptions object's disableImageLoading property. If
    // your network doesn't have an option like this and instead only ever
    // returns URLs for images (rather than the images themselves), your adapter
    // should download image assets on behalf of the publisher. This should be
    // done after receiving the native ad object from your network's SDK, and
    // before calling the connector's adapter:didReceiveMediatedNativeAd: method.
    sampleRequest.shouldDownloadImages = true
    sampleRequest.preferredImageOrientation = NativeAdImageOrientation.any
    sampleRequest.shouldRequestMultipleImages = false
    let options = adConfiguration.options
    for loaderOptions: GADAdLoaderOptions in options {
      if let imageOptions = loaderOptions as? GADNativeAdImageAdLoaderOptions {
        sampleRequest.shouldRequestMultipleImages =
          imageOptions.shouldRequestMultipleImages
        // If the GADNativeAdImageAdLoaderOptions' disableImageLoading property is
        // YES, the adapter should send just the URLs for the images.
        sampleRequest.shouldDownloadImages = !imageOptions.disableImageLoading
      } else if let mediaOptions = loaderOptions
        as? GADNativeAdMediaAdLoaderOptions
      {
        switch mediaOptions.mediaAspectRatio {
        case GADMediaAspectRatio.landscape:
          sampleRequest.preferredImageOrientation =
            NativeAdImageOrientation.landscape
        case GADMediaAspectRatio.portrait:
          sampleRequest.preferredImageOrientation =
            NativeAdImageOrientation.portrait
        default:
          sampleRequest.preferredImageOrientation = NativeAdImageOrientation.any
        }
      }
    }
    // This custom event uses the server parameter to carry an ad unit ID, which
    // is the most common use case.
    adLoader.delegate = self
    adLoader.adUnitID =
      adConfiguration.credentials.settings["parameter"] as? String
    self.completionHandler = completionHandler
    adLoader.fetchAd(sampleRequest)
  }
}

هدف-C

#import "SampleCustomEventNativeAd.h"

@interface SampleCustomEventNativeAd () <SampleNativeAdDelegate,
                                         GADMediationNativeAd> {
  /// The sample native ad.
  SampleNativeAd *_nativeAd;

  /// The completion handler to call when the ad loading succeeds or fails.
  GADMediationNativeLoadCompletionHandler _loadCompletionHandler;

  /// The ad event delegate to forward ad rendering events to the Google Mobile
  /// Ads SDK.
  id<GADMediationNativeAdEventDelegate> _adEventDelegate;
}
@end

- (void)loadNativeAdForAdConfiguration:
            (GADMediationNativeAdConfiguration *)adConfiguration
                     completionHandler:(GADMediationNativeLoadCompletionHandler)
                                           completionHandler {
  __block atomic_flag completionHandlerCalled = ATOMIC_FLAG_INIT;
  __block GADMediationNativeLoadCompletionHandler originalCompletionHandler =
      [completionHandler copy];

  _loadCompletionHandler = ^id<GADMediationNativeAdEventDelegate>(
      _Nullable id<GADMediationNativeAd> ad, NSError *_Nullable error) {
    // Only allow completion handler to be called once.
    if (atomic_flag_test_and_set(&completionHandlerCalled)) {
      return nil;
    }

    id<GADMediationNativeAdEventDelegate> delegate = nil;
    if (originalCompletionHandler) {
      // Call original handler and hold on to its return value.
      delegate = originalCompletionHandler(ad, error);
    }

    // Release reference to handler. Objects retained by the handler will also
    // be released.
    originalCompletionHandler = nil;

    return delegate;
  };

  SampleNativeAdLoader *adLoader = [[SampleNativeAdLoader alloc] init];
  SampleNativeAdRequest *sampleRequest = [[SampleNativeAdRequest alloc] init];

  // The Google Mobile Ads SDK requires the image assets to be downloaded
  // automatically unless the publisher specifies otherwise by using the
  // GADNativeAdImageAdLoaderOptions object's disableImageLoading property. If
  // your network doesn't have an option like this and instead only ever returns
  // URLs for images (rather than the images themselves), your adapter should
  // download image assets on behalf of the publisher. This should be done after
  // receiving the native ad object from your network's SDK, and before calling
  // the connector's adapter:didReceiveMediatedNativeAd: method.
  sampleRequest.shouldDownloadImages = YES;

  sampleRequest.preferredImageOrientation = NativeAdImageOrientationAny;
  sampleRequest.shouldRequestMultipleImages = NO;
  sampleRequest.testMode = adConfiguration.isTestRequest;

  for (GADAdLoaderOptions *loaderOptions in adConfiguration.options) {
    if ([loaderOptions isKindOfClass:[GADNativeAdImageAdLoaderOptions class]]) {
      GADNativeAdImageAdLoaderOptions *imageOptions =
          (GADNativeAdImageAdLoaderOptions *)loaderOptions;
      sampleRequest.shouldRequestMultipleImages =
          imageOptions.shouldRequestMultipleImages;

      // If the GADNativeAdImageAdLoaderOptions' disableImageLoading property is
      // YES, the adapter should send just the URLs for the images.
      sampleRequest.shouldDownloadImages = !imageOptions.disableImageLoading;
    } else if ([loaderOptions
                   isKindOfClass:[GADNativeAdMediaAdLoaderOptions class]]) {
      GADNativeAdMediaAdLoaderOptions *mediaOptions =
          (GADNativeAdMediaAdLoaderOptions *)loaderOptions;
      switch (mediaOptions.mediaAspectRatio) {
        case GADMediaAspectRatioLandscape:
          sampleRequest.preferredImageOrientation =
              NativeAdImageOrientationLandscape;
          break;
        case GADMediaAspectRatioPortrait:
          sampleRequest.preferredImageOrientation =
              NativeAdImageOrientationPortrait;
          break;
        default:
          sampleRequest.preferredImageOrientation = NativeAdImageOrientationAny;
          break;
      }
    } else if ([loaderOptions isKindOfClass:[GADNativeAdViewAdOptions class]]) {
      _nativeAdViewAdOptions = (GADNativeAdViewAdOptions *)loaderOptions;
    }
  }

  // This custom event uses the server parameter to carry an ad unit ID, which
  // is the most common use case.
  NSString *adUnit = adConfiguration.credentials.settings[@"parameter"];
  adLoader.adUnitID = adUnit;
  adLoader.delegate = self;

  [adLoader fetchAd:sampleRequest];
}

خواه تبلیغ با موفقیت واکشی شود یا با خطا مواجه شود، با GADMediationNativeAdLoadCompletionHandler تماس بگیرید. در صورت موفقیت، از کلاسی که GADMediationNativeAd را پیاده سازی می کند با مقدار nil برای پارامتر خطا عبور دهید. در صورت عدم موفقیت، از خطایی که با آن مواجه شدید عبور کنید.

به طور معمول، این روش‌ها در داخل فراخوان‌های SDK شخص ثالثی که آداپتور شما پیاده‌سازی می‌کند، پیاده‌سازی می‌شود. برای این مثال، Sample SDK دارای SampleNativeAdDelegate با تماس‌های مربوطه است:

سریع

func adLoader(
  _ adLoader: SampleNativeAdLoader, didReceive nativeAd: SampleNativeAd
) {
  extraAssets = [
    SampleCustomEventConstantsSwift.awesomenessKey: nativeAd.degreeOfAwesomeness
      ?? ""
  ]

  if let image = nativeAd.image {
    images = [GADNativeAdImage(image: image)]
  } else {
    let imageUrl = URL(fileURLWithPath: nativeAd.imageURL)
    images = [GADNativeAdImage(url: imageUrl, scale: nativeAd.imageScale)]
  }
  if let mappedIcon = nativeAd.icon {
    icon = GADNativeAdImage(image: mappedIcon)
  } else {
    let iconURL = URL(fileURLWithPath: nativeAd.iconURL)
    icon = GADNativeAdImage(url: iconURL, scale: nativeAd.iconScale)
  }

  adChoicesView = SampleAdInfoView()
  self.nativeAd = nativeAd
  if let handler = completionHandler {
    delegate = handler(self, nil)
  }
}

func adLoader(
  _ adLoader: SampleNativeAdLoader,
  didFailToLoadAdWith errorCode: SampleErrorCode
) {
  let error =
    SampleCustomEventUtilsSwift.SampleCustomEventErrorWithCodeAndDescription(
      code: SampleCustomEventErrorCodeSwift
        .SampleCustomEventErrorAdLoadFailureCallback,
      description:
        "Sample SDK returned an ad load failure callback with error code: \(errorCode)"
    )
  if let handler = completionHandler {
    delegate = handler(nil, error)
  }
}

هدف-C

- (void)adLoader:(SampleNativeAdLoader *)adLoader
    didReceiveNativeAd:(SampleNativeAd *)nativeAd {
  if (nativeAd.image) {
    _images = @[ [[GADNativeAdImage alloc] initWithImage:nativeAd.image] ];
  } else {
    NSURL *imageURL = [[NSURL alloc] initFileURLWithPath:nativeAd.imageURL];
    _images = @[ [[GADNativeAdImage alloc] initWithURL:imageURL
                                                 scale:nativeAd.imageScale] ];
  }

  if (nativeAd.icon) {
    _icon = [[GADNativeAdImage alloc] initWithImage:nativeAd.icon];
  } else {
    NSURL *iconURL = [[NSURL alloc] initFileURLWithPath:nativeAd.iconURL];
    _icon = [[GADNativeAdImage alloc] initWithURL:iconURL
                                            scale:nativeAd.iconScale];
  }

  // The sample SDK provides an AdChoices view (SampleAdInfoView). If your SDK
  // provides image and click through URLs for its AdChoices icon instead of an
  // actual UIView, the adapter is responsible for downloading the icon image
  // and creating the AdChoices icon view.
  _adChoicesView = [[SampleAdInfoView alloc] init];
  _nativeAd = nativeAd;

  _adEventDelegate = _loadCompletionHandler(self, nil);
}

- (void)adLoader:(SampleNativeAdLoader *)adLoader
    didFailToLoadAdWithErrorCode:(SampleErrorCode)errorCode {
  NSError *error = SampleCustomEventErrorWithCodeAndDescription(
      SampleCustomEventErrorAdLoadFailureCallback,
      [NSString stringWithFormat:@"Sample SDK returned an ad load failure "
                                 @"callback with error code: %@",
                                 errorCode]);
  _adEventDelegate = _loadCompletionHandler(nil, error);
}

نقشه تبلیغات بومی

SDK های مختلف فرمت های منحصر به فرد خود را برای تبلیغات بومی دارند. به عنوان مثال، یکی ممکن است اشیایی را که حاوی یک فیلد "عنوان" هستند، برگرداند، در حالی که دیگری ممکن است دارای "headline" باشد. علاوه بر این، روش‌های مورد استفاده برای ردیابی نمایش‌ها و پردازش کلیک‌ها می‌تواند از یک SDK به دیگری متفاوت باشد.

برای رسیدگی به این مشکلات، زمانی که یک رویداد سفارشی یک شیء تبلیغاتی بومی را از SDK میانجی خود دریافت می‌کند، باید از کلاسی استفاده کند که GADMediationNativeAd را پیاده‌سازی می‌کند، مانند SampleCustomEventNativeAd ، تا شیء تبلیغاتی بومی SDK واسطه‌شده را «نقشه‌برداری» کند تا با رابط مورد انتظار Google مطابقت داشته باشد. SDK تبلیغات موبایل.

اکنون نگاهی دقیق‌تر به جزئیات پیاده‌سازی SampleCustomEventNativeAd می‌اندازیم.

نقشه های خود را ذخیره کنید

انتظار می‌رود که GADMediationNativeAd ویژگی‌های خاصی را که از دیگر ویژگی‌های SDK نگاشت شده‌اند، پیاده‌سازی کند:

سریع

var nativeAd: SampleNativeAd?

var headline: String? {
  return nativeAd?.headline
}

var images: [GADNativeAdImage]?

var body: String? {
  return nativeAd?.body
}

var icon: GADNativeAdImage?

var callToAction: String? {
  return nativeAd?.callToAction
}

var starRating: NSDecimalNumber? {
  return nativeAd?.starRating
}

var store: String? {
  return nativeAd?.store
}

var price: String? {
  return nativeAd?.price
}

var advertiser: String? {
  return nativeAd?.advertiser
}

var extraAssets: [String: Any]? {
  return [
    SampleCustomEventConstantsSwift.awesomenessKey:
      nativeAd?.degreeOfAwesomeness
      ?? ""
  ]
}

var adChoicesView: UIView?

var mediaView: UIView? {
  return nativeAd?.mediaView
}

هدف-C

/// Used to store the ad's images. In order to implement the
/// GADMediationNativeAd protocol, we use this class to return the images
/// property.
NSArray<GADNativeAdImage *> *_images;

/// Used to store the ad's icon. In order to implement the GADMediationNativeAd
/// protocol, we use this class to return the icon property.
GADNativeAdImage *_icon;

/// Used to store the ad's ad choices view. In order to implement the
/// GADMediationNativeAd protocol, we use this class to return the adChoicesView
/// property.
UIView *_adChoicesView;

- (nullable NSString *)headline {
  return _nativeAd.headline;
}

- (nullable NSArray<GADNativeAdImage *> *)images {
  return _images;
}

- (nullable NSString *)body {
  return _nativeAd.body;
}

- (nullable GADNativeAdImage *)icon {
  return _icon;
}

- (nullable NSString *)callToAction {
  return _nativeAd.callToAction;
}

- (nullable NSDecimalNumber *)starRating {
  return _nativeAd.starRating;
}

- (nullable NSString *)store {
  return _nativeAd.store;
}

- (nullable NSString *)price {
  return _nativeAd.price;
}

- (nullable NSString *)advertiser {
  return _nativeAd.advertiser;
}

- (nullable NSDictionary<NSString *, id> *)extraAssets {
  return
      @{SampleCustomEventExtraKeyAwesomeness : _nativeAd.degreeOfAwesomeness};
}

- (nullable UIView *)adChoicesView {
  return _adChoicesView;
}

- (nullable UIView *)mediaView {
  return _nativeAd.mediaView;
}

- (BOOL)hasVideoContent {
  return self.mediaView != nil;
}

برخی از شبکه‌های واسطه می‌توانند دارایی‌های بیشتری را فراتر از آنهایی که توسط Google Mobile Ads SDK تعریف شده است، ارائه دهند. پروتکل GADMediationNativeAd شامل روشی به نام extraAssets است که Google Mobile Ads SDK برای بازیابی هر یک از این دارایی‌های «اضافی» از نقشه‌بردار شما استفاده می‌کند.

دارایی های تصویر نقشه

نگاشت دارایی های تصویر پیچیده تر از نگاشت انواع داده های ساده تر مانند NSString یا double است. تصاویر ممکن است به صورت خودکار دانلود شوند یا به عنوان مقادیر URL بازگردانده شوند. تراکم پیکسل آنها نیز می تواند متفاوت باشد.

برای کمک به مدیریت این جزئیات، Google Mobile Ads SDK کلاس GADNativeAdImage را ارائه می‌کند. اطلاعات دارایی تصویر (خواه اشیاء واقعی UIImage یا فقط مقادیر NSURL ) باید با استفاده از این کلاس به Google Mobile Ads SDK برگردانده شوند.

در اینجا نحوه ایجاد یک GADNativeAdImage برای نگه داشتن تصویر نماد توسط کلاس mapper آمده است:

سریع

if let image = nativeAd.image {
  images = [GADNativeAdImage(image: image)]
} else {
  let imageUrl = URL(fileURLWithPath: nativeAd.imageURL)
  images = [GADNativeAdImage(url: imageUrl, scale: nativeAd.imageScale)]
}

هدف-C

if (nativeAd.image) {
  _images = @[ [[GADNativeAdImage alloc] initWithImage:nativeAd.image] ];
} else {
  NSURL *imageURL = [[NSURL alloc] initFileURLWithPath:nativeAd.imageURL];
  _images = @[ [[GADNativeAdImage alloc] initWithURL:imageURL
                                               scale:nativeAd.imageScale] ];
}

رویدادهای نمایش و کلیک

هم Google Mobile Ads SDK و هم SDK واسطه‌شده باید بدانند چه زمانی یک نمایش یا کلیک روی می‌دهد، اما فقط یک SDK باید این رویدادها را ردیابی کند. بسته به اینکه آیا SDK واسطه‌شده از ردیابی نمایش‌ها و کلیک‌ها به تنهایی پشتیبانی می‌کند، رویدادهای سفارشی می‌توانند از دو رویکرد متفاوت استفاده کنند.

کلیک‌ها و نمایش‌ها را با Google Mobile Ads SDK ردیابی کنید

اگر SDK واسطه‌شده ردیابی نمایش و کلیک خود را انجام ندهد، اما روش‌هایی برای ثبت کلیک‌ها و نمایش‌ها ارائه کند، Google Mobile Ads SDK می‌تواند این رویدادها را ردیابی کند و به آداپتور اطلاع دهد.GADMediationNativeAd protocol شامل دو روش است:didRecordImpression: و didRecordClickOnAssetWithName:view:viewController: که رویدادهای سفارشی می توانند برای فراخوانی روش متناظر در شیء تبلیغات بومی واسطه ای پیاده سازی کنند:

سریع

func didRecordImpression() {
  nativeAd?.recordImpression()
}

func didRecordClickOnAsset(
  withName assetName: GADUnifiedNativeAssetIdentifier,
  view: UIView,
  wController: UIViewController
) {
  nativeAd?.handleClick(on: view)
}

هدف-C

- (void)didRecordImpression {
  if (self.nativeAd) {
    [self.nativeAd recordImpression];
  }
}

- (void)didRecordClickOnAssetWithName:(GADUnifiedNativeAssetIdentifier)assetName
                                 view:(UIView *)view
                       viewController:(UIViewController *)viewController {
  if (self.nativeAd) {
    [self.nativeAd handleClickOnView:view];
  }
}

از آنجایی که کلاسی که پروتکل GADMediationNativeAd protocolرا پیاده‌سازی می‌کند، مرجعی به شیء تبلیغاتی نمونه SDK دارد، می‌تواند متد مناسب را روی آن شی برای گزارش کلیک یا نمایش فراخوانی کند. توجه داشته باشید که روشdidRecordClickOnAssetWithName:view:viewController: یک پارامتر واحد را می گیرد: شی View مربوط به دارایی تبلیغاتی بومی که کلیک را دریافت کرده است.

ردیابی کلیک‌ها و برداشت‌ها با SDK واسطه

برخی از SDK های واسطه ممکن است ترجیح دهند کلیک ها و نمایش ها را به تنهایی ردیابی کنند. در آن صورت، باید متدهای handlesUserClicks و handlesUserImpressions را همانطور که در قطعه زیر نشان داده شده است پیاده سازی کنید. با بازگشت YES ، نشان می‌دهید که رویداد سفارشی مسئولیت ردیابی این رویدادها را بر عهده می‌گیرد و در صورت وقوع این رویدادها به Google Mobile Ads SDK اطلاع می‌دهد.

رویدادهای سفارشی که ردیابی کلیک و نمایش را لغو می‌کنند، می‌توانند از پیام didRenderInView: برای ارسال نمای آگهی بومی به شیء تبلیغاتی بومی SDK واسطه‌شده استفاده کنند تا به SDK واسطه‌شده اجازه دهد تا ردیابی واقعی را انجام دهد. نمونه SDK از پروژه نمونه رویداد سفارشی ما (که قطعه کد این راهنما از آن گرفته شده است) setNativeAdView:view: این رویکرد استفاده نمی کند. :

سریع

func handlesUserClicks() -> Bool {
  return true
}
func handlesUserImpressions() -> Bool {
  return true
}

func didRender(
  in view: UIView, clickableAssetViews: [GADNativeAssetIdentifier: UIView],
  nonclickableAssetViews: [GADNativeAssetIdentifier: UIView],
  viewController: UIViewController
) {
  // This method is called when the native ad view is rendered. Here you would pass the UIView
  // back to the mediated network's SDK.
  self.nativeAd?.setNativeAdView(view)
}

هدف-C

- (BOOL)handlesUserClicks {
  return YES;
}

- (BOOL)handlesUserImpressions {
  return YES;
}

- (void)didRenderInView:(UIView *)view
       clickableAssetViews:(NSDictionary<GADNativeAssetIdentifier, UIView *> *)
                               clickableAssetViews
    nonclickableAssetViews:(NSDictionary<GADNativeAssetIdentifier, UIView *> *)
                               nonclickableAssetViews
            viewController:(UIViewController *)viewController {
  // This method is called when the native ad view is rendered. Here you would
  // pass the UIView back to the mediated network's SDK. Playing video using
  // SampleNativeAd's playVideo method
  [_nativeAd setNativeAdView:view];
}

رویدادهای میانجی را به Google Mobile Ads SDK بازارسال کنید

هنگامی که GADMediationNativeLoadCompletionHandler را با یک آگهی بارگذاری شده فراخوانی کردید، شیء نماینده بازگردانده شده GADMediationNativeAdEventDelegate می تواند توسط آداپتور برای ارسال رویدادهای ارائه از SDK شخص ثالث به Google Mobile Ads SDK استفاده شود.

مهم است که رویداد سفارشی شما تا آنجایی که ممکن است این تماس‌های پاسخگو را فوروارد کند تا برنامه شما این رویدادهای مشابه را از Google Mobile Ads SDK دریافت کند. در اینجا مثالی از استفاده از callback آورده شده است:

این پیاده سازی رویدادهای سفارشی را برای تبلیغات بومی تکمیل می کند. نمونه کامل در GitHub موجود است.