Native Ad mediation forward events to AdMob

248 views
Skip to first unread message

Charles Wang

unread,
Jan 28, 2022, 5:15:33 AM1/28/22
to Google Mobile Ads SDK Developers
Hi,
I try to use native ad custom events to mediate with other ad network.
I follow the document here. 
https://developers.google.com/admob/ios/custom-events/native?hl=en
I can successfully request and present an ad via mediation custom event.
And I set GADCustomEventNativeAd protocol handlesUserClicks and handlesUserImpressions to YES, let the other ad network SDK track clicks and impressions but I can not find a way to forward these events to AdMob SDK.

The GADCustomEventNativeAdDelegate can only forward this two events:
customEventNativeAd:didReceiveMediatedUnifiedNativeAd:
customEventNativeAd:didFailToLoadWithError:

And I try GADMediatedUnifiedNativeAdNotificationSource class function like:
extension SampleMediatedUnifiedNativeAd: SampleNativeAdDelegate {
    func nativeAdDidImpression(_ ad: SampleNativeAd!) {
        GADMediatedUnifiedNativeAdNotificationSource.mediatedNativeAdDidRecordImpression(self)      
    }
   
    func nativeAdDidClick(_ ad: SampleNativeAd!) {
      GADMediatedUnifiedNativeAdNotificationSource.mediatedNativeAdDidRecordClick(self)        
    }    
}

But the GADNativeAd GADNativeAdDelegate not receive the callback.
nativeAdDidRecordClick(_ nativeAd: GADNativeAd)
nativeAdDidRecordImpression(_ nativeAd: GADNativeAd)

I use Google-Mobile-Ads-SDK 8.13.0 version.
Please help, thank you.

Mobile Ads SDK Forum Advisor

unread,
Jan 28, 2022, 10:22:30 AM1/28/22
to charle...@gmail.com, google-adm...@googlegroups.com

Hi Charles,

Thank you for reaching out to us.

For us to further check your implementation, can you provide us your sample app with your implementation? In addition to that, can you provide us a clear steps of what you're trying to forward using this events? You can send the requested details by following the instructions below.

If the file(s) you are looking to share are less than 25mb in total you can attach them to this case on your next reply. If you are having trouble attaching your file to this case or if your file(s) are larger than 25mb, you can share your files with me by performing the following steps:

1. Navigate to https://docs.google.com/forms/d/e/1FAIpQLSfkAiXMeYP-fw1W3Z-tT9uwmATEKO5X6S-th0gR2ezdKaaqfg/viewform?usp=pp_url&entry.400550049=Mobile+Ads+SDK&entry.460850823=5004Q00002VQQEQQA5&entry.80707362=00092607
2. Fill out all fields, and attach your file(s).
3. Please reply back on this thread when you have uploaded your file(s). Please do not share this link.

Regards,

Google Logo
Princess Pamela Pineda
Mobile Ads SDK Team
 


ref:_00D1U1174p._5004Q2VQQEQ:ref

zizoo diesel

unread,
Feb 5, 2022, 6:13:06 PM2/5/22
to Google Mobile Ads SDK Developers
Same here, did you find a fix for this issue?

Thanks

Charles Wang

unread,
Feb 5, 2022, 10:42:37 PM2/5/22
to Google Mobile Ads SDK Developers
Hi,
I just uploaded our sample app, and I mark my question with  /* Issue */ in the sample app.
Please check thank you.

mobileadssdk 在 2022年1月28日 星期五下午11:22:30 [UTC+8] 的信中寫道:

Mobile Ads SDK Forum Advisor

unread,
Feb 7, 2022, 4:32:10 AM2/7/22
to charle...@gmail.com, google-adm...@googlegroups.com

Hi Charles,

Thank you for providing the requested additional information.

Upon checking, I was able to encounter an error in building it. I've attached the screenshot of the error I've got. Can you provide us the steps you made so that we can check it step by step as how you’re checking it also in your end?

Screen Shot 2022-02-07 at 5.08.07 PM.png

Charles Wang

unread,
Feb 8, 2022, 11:06:56 AM2/8/22
to Google Mobile Ads SDK Developers
Hi,
The error occurs due to I did not include pods file in the sample project. 
1. Command line run pod install
2. Run the sample app in real device (It will use custom event to request Ad)
3. Click Native Ad button
4. Click Show Ad button
5. Request and receive an Ad from TADCustomNative class (Third party media network)
6. Click the Ad 
7. TADMediatedUnifiedNativeAd will receive the click callback
  extension TADMediatedUnifiedNativeAd: TADNativeAdDelegate {
    /* Want to forward event to GADNativeAd */
    func nativeAdDidClick(_ ad: TADNativeAd!) {
        GADMediatedUnifiedNativeAdNotificationSource.mediatedNativeAdDidRecordClick(self)
    }
}
8. In NativeAdViewController GADNativeAdDelegate didn't receive click event.
extension NativeAdViewController: GADNativeAdDelegate { 
/* Do not receive click event  */   
    func nativeAdDidRecordClick(_ nativeAd: GADNativeAd) {
        print("gad nativeAdDidRecordClick")
    }
}

And I noticed that Android SDK provides onAdClicked and onAdImpression event forward to the Google Mobile Ads SDK, but iOS SDK does not?


mobileadssdk 在 2022年2月7日 星期一下午5:32:10 [UTC+8] 的信中寫道:

Mobile Ads SDK Forum Advisor

unread,
Feb 9, 2022, 1:52:13 AM2/9/22
to charl...@taiwanmobile.com, google-adm...@googlegroups.com

Hi Charles,

Thank you for providing the steps.

Can you confirm if your concern is that the callback for "nativeAdDidRecordClick" and "nativeAdDidRecordImpressionare not being called? If this is the case, upon testing your sample app, I was able to call those callbacks as they are being printed on the logs using your sample app provided. 

Charles Wang

unread,
Feb 9, 2022, 9:00:11 PM2/9/22
to Google Mobile Ads SDK Developers
Hi,
Yes, my conecert is the the callback for "nativeAdDidRecordClick" and "nativeAdDidRecordImpression" are not being called.
But, you were able to call those callbacks? It's weird. I am sure that these two callbacks not being called. 
Did you change any anything of the sample app?
  extension NativeAdViewController: GADNativeAdDelegate {

    func nativeAdDidRecordClick(_ nativeAd: GADNativeAd) {
       print("gad nativeAdDidRecordClick")
    }
    func nativeAdDidRecordImpression(_ nativeAd: GADNativeAd) {
        print("gad nativeAdDidRecordImpression")
    }
}
And, I use Xcode 13.1, iPhone 12 Pro (iOS 14.4.2)
mobileadssdk 在 2022年2月9日 星期三下午2:52:13 [UTC+8] 的信中寫道:

Mobile Ads SDK Forum Advisor

unread,
Feb 10, 2022, 3:50:26 AM2/10/22
to charl...@taiwanmobile.com, google-adm...@googlegroups.com

Hi Charles,

Thank you for your response.

I didn't change anything in the sample project you provided. Can you confirm if the screenshot I provided is the one that you are referring to? I was able to print it in the logs, so it means that it was able to be called.

Regards,

Google Logo
Princess Pamela
Mobile Ads SDK Team
 


ref:_00D1U1174p._5004Q2VQQEQ:ref
Screen Shot 2022-02-10 at 3.20.25 PM.png

Charles Wang

unread,
Feb 10, 2022, 4:22:23 AM2/10/22
to Google Mobile Ads SDK Developers
Hi, 
Yes, the logs are what I am referring to.
But I would like to make sure that did you run the sample app in a real device?
If you run the app in simulator you will receive a test ad from google, not from third party ad network. And the two callbacks function will be call certainly.
If you run the app in real device you will got an ad through the mediation class TADCustomNative and TADMediatedUnifiedNativeAd, and the two callbacks function will not be called.


mobileadssdk 在 2022年2月10日 星期四下午4:50:26 [UTC+8] 的信中寫道:

Charles Wang

unread,
Feb 11, 2022, 3:34:52 AM2/11/22
to Google Mobile Ads SDK Developers
Hi, 
I would like to provide more information for you.
I tried to display a video ad and I used "GADMediatedUnifiedNativeAdNotificationSource" to forward video event to GADNativeAd.
GADMediatedUnifiedNativeAdNotificationSource.mediatedNativeAdDidPlayVideo(self)
GADMediatedUnifiedNativeAdNotificationSource.mediatedNativeAdDidPauseVideo(self)
GADMediatedUnifiedNativeAdNotificationSource.mediatedNativeAdDidEndVideoPlayback(self)
The GADVideoControllerDelegate callbacks are being called successfully.
extension NativeAdViewController: GADVideoControllerDelegate {        
    func videoControllerDidPlayVideo(_ videoController: GADVideoController) {
        print("gad videoControllerDidPlayVideo")
    }        
    func videoControllerDidPauseVideo(_ videoController: GADVideoController) {
        print("gad videoControllerDidPauseVideo")
    }    
    func videoControllerDidEndVideoPlayback(_ videoController: GADVideoController) {
        print("gad videoControllerDidEndVideoPlayback")
    }
}

Therefore, I thought the issue is these two function "mediatedNativeAdDidRecordImpression" and "mediatedNativeAdDidRecordClick" of GADMediatedUnifiedNativeAdNotificationSource not work correctly or there was something wrong of my integration.
And I also tried to integrate Facebook Audience Network with mediation, the callback for "nativeAdDidRecordClick" and "nativeAdDidRecordImpressionare not being called either.

Regards,

Charles Wang 在 2022年2月10日 星期四下午5:22:23 [UTC+8] 的信中寫道:

Charles Wang

unread,
Feb 14, 2022, 5:14:28 AM2/14/22
to Google Mobile Ads SDK Developers
Hi,
Do you have any updates about this issue?
Thank you.

Regards,


Charles Wang 在 2022年2月11日 星期五下午4:34:52 [UTC+8] 的信中寫道:
Reply all
Reply to author
Forward
0 new messages