Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mobile PUC Failover App Event #255

Open
justadreamer opened this issue Feb 12, 2025 · 4 comments
Open

Mobile PUC Failover App Event #255

justadreamer opened this issue Feb 12, 2025 · 4 comments

Comments

@justadreamer
Copy link

justadreamer commented Feb 12, 2025

Background

Context: Mobile Original API integration where PUC is rendered by Google Mobile Ads SDK. Sometimes PUC fails to load an actual creative from prebid-cache and that results in a blank ad staying until the ad unit is refreshed by the application code.

Proposed Solution

Signal to the application native code that there was a failure within the creative and allow the app to supply a callback in the native code that will be able to reload the ad unit or do whatever logic app developers would like to do. This can be achieved using App Events:

Here is how it works. The creative code includes this:

<script src="//www.gstatic.com/afma/api/v1/google_mobile_app_ads.js"></script>
<script>
  admob.events.dispatchAppEvent("prebid", "failover");
</script>

The native code subscribes to these events through the delegate method:

func bannerView(_ banner: GAMBannerView, didReceiveAppEvent name: String,
    withInfo info: String?) {
   if name=="prebid" && info=="failover" {
     // do failover logic - f.e. reload the banner
   }
}

Other question to consider: should it pass rather cache_uuid/bidder or some other piece of data to the native layer for logging / reporting purposes?

Testing and Documentation

There are testing and documentation aspects to this.
Testing - we need to make sure the mechanism works as part of the Mobile Demo apps.
Documentation - the website needs to publish a note on this feature in the mobile section - so publishers are made aware that they can use it in their app code.

Related

There is a ticket in the mobile SDK proposing to get rid of cache requests all together: prebid/prebid-mobile-ios#1103. Until that is implemented - this may be a viable and easy to implement option.

Additional Info

MoPub used to have a similar feature that would simply trigger reloads - and allowed custom JS creatives to just call "mopub://failover" URL to move to the next one in the waterfall - was a huge convenience. MoPub no longer exists and not sure if AppLovin provides this. Clearly GAM provides app events which are more flexible, so why not use them?

cc: @bretg @YuriyVelichkoPI

@justadreamer
Copy link
Author

Note: should be discussed as part of Mobile PMC more rather than Prebid.js.

@justadreamer
Copy link
Author

suggestion from the PMC: should be an opt-in feature, perhaps pass the "failover" closure from the outer context like GAM creative setup - as a parameter to the PUC. If not provided - no failover behavior :)

@justadreamer
Copy link
Author

suggestion from the PMC: analytics is another aspect of this - should we track any events from within the PUC or from this failover closure - perhaps pass the cache_id to the failover closure.

@bretg
Copy link
Contributor

bretg commented Feb 18, 2025

@justadreamer and I discussed:

  • Update the PUC to write the javascript to the iframe that fires this event when the read from PBC fails. Let's call this a "prebid.fallback" event
  • Add instructions for how the app needs to be updated
  • Add an option so pubs who don't want this event to fire can suppress it. e.g. ucTagData.suppressFallbackEvents is a new boolean that defaults to false.
  var ucTagData = {};
  ucTagData.adServerDomain = "";
  ...
  ucTagData.suppressFallbackEvents = true;    // new option

  try {
    ucTag.renderAd(document, ucTagData);
  } catch (e) {
    console.log(e);
  }

We should implement all the open PUC enhancements and then test because PUC releases are some effort to test and release. Other PUC mobile issues:

@dgirardi dgirardi moved this from Triage to Tracking in Prebid.js Tactical Issues table Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Tracking
Development

No branches or pull requests

2 participants