How to trigger app event before banner is received

81 views
Skip to first unread message

Emir

unread,
Jul 23, 2023, 8:08:06 PM7/23/23
to Google Mobile Ads SDK Developers
Hello,

I have a question about app events.

The Mobile Ads SDK iOS page says on https://developers.google.com/ad-manager/mobile-ads-sdk/ios/banner I quote:
"You can listen for Ad Manager-specific app events using GADAppEventDelegate. These events may occur at any time during the ad's lifecycle, even before the GADBannerViewDelegate object's bannerViewDidReceiveAd: is called."

Does anyone know how do I trigger an event that will occur before bannerViewDidReceiveAd is called? Every time I try the banner is first loaded and then it receives the events.

Thank you!

Mobile Ads SDK Forum Advisor

unread,
Jul 24, 2023, 3:21:54 AM7/24/23
to em...@sakic.net, google-adm...@googlegroups.com
Hello Emir,

Thank you for reaching out to us.

Kindly refer to this link for an example implementation of app events in the iOS API Demo app: https://github.com/googleads/googleads-mobile-ios-examples/blob/main/Swift/advanced/APIDemo/APIDemo/AdManagerAppEventsViewController.swift.

Remember to set the delegate using the appEventDelegate property before making the request for an ad. More information in this link: https://developers.google.com/ad-manager/mobile-ads-sdk/ios/banner#app_events.

Feel free to reach back to us if you have any further concerns or inquiries.
 
This message is in relation to case "ref:_00D1U1174p._5004Q2nRnZY:ref"

Thanks,
 
Google Logo Mobile Ads SDK Team


Emir Sakic

unread,
Jul 24, 2023, 4:22:07 AM7/24/23
to mobile...@forumsupport.google, google-adm...@googlegroups.com
Hello and thanks for your answer.

Yes, I've seen this of course and, while it's working fine, the event is received only after bannerViewDidReceiveAd has been called. The documentation mentions specifically a possibility to detect an event "even before the GADBannerViewDelegate object's bannerViewDidReceiveAd: is called".

Do you have any examples of how such an event would be triggered?

Thanks!
--

Mobile Ads SDK Forum Advisor

unread,
Jul 24, 2023, 8:48:52 AM7/24/23
to em...@sakic.net, google-adm...@googlegroups.com
Hi Emir,

Thank you for responding back.

As per your concern, the statement "possibility to detect an event "even before the GADBannerViewDelegate object's bannerViewDidReceiveAd: is called" is referring to when ads failed to load which will trigger the didFailToReceiveAdWithError callback.

Emir Sakic

unread,
Jul 24, 2023, 12:27:50 PM7/24/23
to Mobile Ads SDK Forum Advisor, google-adm...@googlegroups.com
Hello,

That's confusingly put in the documentation in that case and certainly not how it may be interpreted.

It's unfortunate that it can't be achieved then. As an alternative, is it possible to somehow identify the banner that has been loaded within the bannerViewDidReceiveAd method, by its Ad Manager name or some other property? I tried the responseInfo property, but it comes up pretty much empty when it loads the Ad Manager banner.

Thank you.

Mobile Ads SDK Forum Advisor

unread,
Jul 24, 2023, 5:11:00 PM7/24/23
to em...@sakic.net, google-adm...@googlegroups.com

Hi Emir,

Thank you for your response.

With regard to your question, for retrieving the ads information, the only available in our documentation is to get it by using this guide (https://developers.google.com/ad-manager/mobile-ads-sdk/ios/response-info). It mentioned that, for debugging and logging purposes, successfully loaded ads provide a GADResponseInfo (https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Classes/GADResponseInfo) object. This object contains information about the ad it loaded, in addition to information about the mediation waterfall used to load the ad.

Emir Sakic

unread,
Jul 24, 2023, 6:32:24 PM7/24/23
to Mobile Ads SDK Forum Advisor, google-adm...@googlegroups.com
Yes, I tried that, but it's pretty useless for Ad Manager banners, everything comes pretty much empty:

Optional(  ** Response Info **

    Response ID: CMDyse2xqIADFQEX4AodgX8Lfw

    Network: GADMAdapterGoogleAdMobAds


  ** Loaded Adapter Response **

    Network: GADMAdapterGoogleAdMobAds

    Ad Source Name:

    Ad Source ID:

    Ad Source Instance Name:

    Ad Source Instance ID:

    AdUnitMapping:

{

}

    Error: (null)

    Latency: 1.639


  ** Extras Dictionary **

    {

    }


  ** Mediation line items **

    Entry (1)

    Network: GADMAdapterGoogleAdMobAds

    Ad Source Name:

    Ad Source ID:

    Ad Source Instance Name:

    Ad Source Instance ID:

    AdUnitMapping:

{

}

    Error: (null)

    Latency: 1.639

)


It does contain some more info for banners from AdMob:

Optional(  ** Response Info **

    Response ID: CO3XqpyyqIADFQ6gewodBRQGgg

    Network: GADMAdapterGoogleAdMobAds


  ** Loaded Adapter Response **

    Network: GADMAdapterGoogleAdMobAds

    Ad Source Name:AdMob Network

    Ad Source ID:5450213213286189855

    Ad Source Instance Name:AdMob (default)

    Ad Source Instance ID:AdMob (default)

    AdUnitMapping:

{

}

    Error: (null)

    Latency: 1.530


  ** Extras Dictionary **

    {

        "mediation_group_name" = "AdMob (default)";

    }


  ** Mediation line items **

    Entry (1)

    Network: GADMAdapterGoogleAdMobAds

    Ad Source Name:AdMob Network

    Ad Source ID:5450213213286189855

    Ad Source Instance Name:AdMob (default)

    Ad Source Instance ID:AdMob (default)

    AdUnitMapping:

{

}

    Error: (null)

    Latency: 1.530

)


I would need something to help identify the banner from GAD during the receive event.

Ah well, I will keep testing, thanks for trying to help. :)

Mobile Ads SDK Forum Advisor

unread,
Jul 25, 2023, 6:15:47 AM7/25/23
to em...@sakic.net, google-adm...@googlegroups.com
Hello Emir,

Would you kindly share to us what specific ad information you wish to acquire and how you will use the information before the bannerViewDidReceiveAd is called?

Emir Sakic

unread,
Jul 25, 2023, 11:42:07 AM7/25/23
to Mobile Ads SDK Forum Advisor, google-adm...@googlegroups.com
Hello,

I would like to know which GAM banner is being served, order name, line item name or something like that. Based on that, the app should make a mediation by displaying the banner or making an AdMob request.

Thanks.

Mobile Ads SDK Forum Advisor

unread,
Jul 25, 2023, 1:21:50 PM7/25/23
to em...@sakic.net, google-adm...@googlegroups.com

Hi Emir,

Thank you for your response.

We've found an existing request to the wider team with regard to this, and our team mentioned that, Loading the ad, and checking on-device that the ad shouldn't be shown is late in the process, consumes network/device resources, and affects reporting in terms of ads loaded. The competitive exclusions (https://support.google.com/admanager/answer/190582#competitive-exclusions) feature in Ad Manager is intended to prevent these ads at serving time. The correlator ad request parameter (more info at https://support.google.com/admanager/answer/10660756#correlator) powers that competitive exclusions feature.

We recommend reaching out to the publisher support team via this link (https://support.google.com/admanager/community?hl=en) for additional questions about competitive exclusions features. 

Reply all
Reply to author
Forward
0 new messages