ज़रूरी शर्तें
कस्टम इवेंट का सेटअप पूरा करें.
नेटिव विज्ञापन का अनुरोध करें
वॉटरफ़ॉल मीडिएशन चेन में कस्टम इवेंट लाइन आइटम के पहुंचने पर,the loadNativeAd:adConfiguration:completionHandler:
method को उस क्लास के नाम पर कॉल किया जाता है जो आपने कस्टम इवेंट बनाते समय दिया था. इस मामले में, वह तरीका SampleCustomEvent
में है, जिसके बादthe loadNativeAd:adConfiguration:completionHandler:
method में SampleCustomEventNative
कॉल करेगा.
नेटिव विज्ञापन का अनुरोध करने के लिए, GADMediationAdapter
और loadNativeAd:adConfiguration:completionHandler:
को लागू करने वाली क्लास बनाएं या उसमें बदलाव करें. अगर
GADMediationAdapter
को बढ़ाने वाली क्लास पहले से मौजूद है, तो वहां
loadNativeAd:adConfiguration:completionHandler:
को लागू करें. इसके अलावा, GADMediationNativeAd
को लागू करने के लिए एक नई क्लास बनाएं.
कस्टम इवेंट के हमारे उदाहरण में, SampleCustomEvent
इसे लागू करता है
the GADMediationAdapter
interface और फिर इसे
SampleCustomEventNative
में सौंपता है.
Swift
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) } }
Objective-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 पर विज्ञापन इवेंट कॉलबैक पाना और उन्हें रिपोर्ट करना
Ad Manager यूज़र इंटरफ़ेस (यूआई) में तय किया गया वैकल्पिक पैरामीटर,
विज्ञापन कॉन्फ़िगरेशन में शामिल है.
इस पैरामीटर को
adConfiguration.credentials.settings[@"parameter"]
से ऐक्सेस किया जा सकता है. आम तौर पर, यह पैरामीटर एक विज्ञापन यूनिट आइडेंटिफ़ायर होता है. किसी विज्ञापन ऑब्जेक्ट को तुरंत चालू करने के लिए, विज्ञापन नेटवर्क SDK टूल की ज़रूरत होती है.
Swift
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) } }
Objective-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
पर कॉल करना होगा. सफलता मिलने पर,
उस क्लास को पास करें जो गड़बड़ी पैरामीटर के लिए nil
वैल्यू के साथ GADMediationNativeAd
को लागू करती है. ऐसा नहीं होने पर, आपको हुई गड़बड़ी को ठीक करें.
आम तौर पर, इन तरीकों को तीसरे पक्ष के SDK टूल से कॉलबैक में लागू किया जाता है. यह SDK टूल, आपका अडैप्टर इस्तेमाल करता है. इस उदाहरण के लिए, सैंपल SDK टूल में काम के कॉलबैक के साथ एक SampleNativeAdDelegate
है:
Swift
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) } }
Objective-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 टूल के अलग-अलग फ़ॉर्मैट होते हैं. उदाहरण के लिए, एक ऐसा ऑब्जेक्ट दिख सकता है जिसमें "टाइटल" फ़ील्ड होता है, जबकि दूसरे में "हेडलाइन" हो सकती है. इसके अलावा, इंप्रेशन को ट्रैक करने और क्लिक प्रोसेस करने के लिए इस्तेमाल किए जाने वाले तरीके एक SDK टूल से दूसरे में अलग-अलग हो सकते हैं.
इन समस्याओं को ठीक करने के लिए, जब किसी कस्टम इवेंट को अपने मीडिएशन वाले SDK टूल से नेटिव विज्ञापन ऑब्जेक्ट मिलता है, तो उसे मीडिएशन वाले SDK टूल के नेटिव विज्ञापन ऑब्जेक्ट को "मैप" करने के लिए, GADMediationNativeAd
लागू करने वाली क्लास का इस्तेमाल करना चाहिए.
जैसे, SampleCustomEventNativeAd
.
अब हम
SampleCustomEventNativeAd
को लागू करने से जुड़ी जानकारी को बारीकी से देखते हैं.
अपनी मैपिंग सेव करें
अन्य SDK टूल की प्रॉपर्टी से मैप की गई कुछ प्रॉपर्टी को GADMediationNativeAd
लागू करेगा:
Swift
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 }
Objective-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
जैसे आसान डेटा टाइप को मैप करने से ज़्यादा मुश्किल है. इमेज अपने-आप डाउनलोड हो सकती हैं या
यूआरएल वैल्यू के तौर पर दिखाई जा सकती हैं. अलग-अलग पिक्सल की सघनता भी अलग-अलग हो सकती है.
इस जानकारी को मैनेज करने में आपकी मदद के लिए, Google Mobile Ads SDK GADNativeAdImage
क्लास उपलब्ध कराता है. इस क्लास का इस्तेमाल करके, इमेज एसेट की जानकारी (चाहे वह असल UIImage
ऑब्जेक्ट हो या सिर्फ़ NSURL
वैल्यू हो), Google Mobile Ads SDK को दिखाई जानी चाहिए.
यहां बताया गया है कि मैपर क्लास, आइकॉन इमेज को होल्ड करने के लिए GADNativeAdImage
कैसे बनाती है:
Swift
if let image = nativeAd.image { images = [GADNativeAdImage(image: image)] } else { let imageUrl = URL(fileURLWithPath: nativeAd.imageURL) images = [GADNativeAdImage(url: imageUrl, scale: nativeAd.imageScale)] }
Objective-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:
जिन
कस्टम इवेंट को मीडिएशन वाले नेटिव विज्ञापन ऑब्जेक्ट पर, मिलते-जुलते तरीके को कॉल करने के लिए लागू किया जा सकता है:
Swift
func didRecordImpression() { nativeAd?.recordImpression() } func didRecordClickOnAsset( withName assetName: GADUnifiedNativeAssetIdentifier, view: UIView, wController: UIViewController ) { nativeAd?.handleClick(on: view) }
Objective-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:
तरीके को नीचे दिए गए स्निपेट में दिखाए गए तरीके से कॉल करेगा:
Swift
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) }
Objective-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 से मिलते-जुलते इवेंट मिल सकें. यहां कॉलबैक इस्तेमाल करने का एक उदाहरण दिया गया है:
इससे नेटिव विज्ञापनों के लिए कस्टम इवेंट लागू करने की प्रोसेस पूरी हो जाती है. इसका पूरा उदाहरण GitHub पर उपलब्ध है.