Unity Plugin - Ad optimization
Best loaded ad
GetBestLoadedAd returns the ad the next Show* call would display, including its network and revenue, or null if there is none. Use it, for example, to decide whether an ad is worth showing:
var best = A11MediationSDK.GetBestLoadedAd("adUnitID");
if (best != null && best.Revenue >= 2.0)
A11MediationSDK.ShowInterstitial("adUnitID");
To be notified of changes instead, subscribe to OnBestLoadedAdChanged:
A11MediationSDK.OnBestLoadedAdChanged += (adUnitId, adInfo) =>
{
// adInfo is null when no ad is ready
};
External loss reporting
If an impression for an ad unit goes to an ad source outside the MDN11 SDK, call NotifyLossToExternal, so the MDN11 SDK can factor it into its decisions.
A11MediationSDK.NotifyLossToExternal("adUnitID", price: 2.50); // eCPM the external source served at
// Or when the price isn't known:
A11MediationSDK.NotifyLossToExternal("adUnitID");
Caution
price must be the eCPM (effective cost per mille) the external source served at. A price that is zero, negative, NaN or infinite is logged as an error, and the loss is reported without a price.
Info
A loss reaches the MDN11 SDK only for an ad unit you have already loaded in this session and have not destroyed since. A report made before the ad unit's first Load* call, or after DestroyBanner / DestroyMrec, is logged and ignored. If your game can show an external ad at session start, load the MDN11 ad unit first.