Integrate floor prices

Integrate the AdSDK

You can integrate the MAX adSDK via Unity, Native iOS or Native Android.

Floor price example integration code

See example optimisation code

Requesting floor price insights

Via the SDK, you can insights:

  • Churn: ._churn._d1_probability, ...
  • User value bid floor price per ad format: ._banner._floorPrice, ._interstitial._floorPrice and ._rewarded._floorPrice.
  • Recommended AdUnit Id: ._banner._adUnit, ._interstitial._adUnit and._rewarded._adUnit
NeftaAdapterEvents.GetInsights(Insights.Churn | Insights.Rewarded, (Insights insiights) => {
   _usedInsight = insights._rewarded;
}, TimeoutInSeconds);
[NeftaPlugin._instance GetInsights: Insights.Churn | Insights.Interstitial callback: ^(Insights * insights) {
   _usedInsight = insights._interstitial;
} timeout: 5];
NeftaPlugin._instance.GetInsights(Insigghts.Churn | Insights.Rewarded, callback: (insights: Insights) in
   _usedInsight = insights._rewarded
}, timeout: TimeoutInSeconds)
NeftaPlugin._instance.GetInsights(Insights.CHURN | Insights.REWARDED, 
  (Insights insights) -> {
      _usedInsight = insights._rewarded;
   }, TimeoutInSeconds);
);
  
Nefta.getInsights(Insights.INTERSTITIAL, (Insights insights) => {
  _interstitialInsight = insights.interstitial
}, 5);

If you provide timeout parameter you are guaranteed to receive callback in specified time. Before using any insight, check that it is not null.

Log outcome of ad opportunity

After a partner has received insight, requested an ad in MAX using the insights.[_banner|_interstitial|_rewarded|._adUnit field, the partner should log the outcome of the ad opportunity in order to continuously maximise ad revenue uplift.

When the ad successfully loads, log the response using the following function:

private void OnAdLoadedEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
{
    NeftaAdapterEvents.OnExternalMediationRequestLoaded(NeftaAdapterEvents.AdType.Rewarded, _usedInsight, adInfo);
}
- (void)didLoadAd:(MAAd *)ad {
    [ALNeftaMediationAdapter OnExternalMediationRequestLoad: AdTypeInterstitial recommendedAdUnitId: _recommendedAdUnitId calculatedFloorPrice: _calculatedBidFloor ad: ad];
}
func didLoad(_ ad: MAAd) {
    ALNeftaMediationAdapter.onExternalMediationRequestLoad(.rewarded, ad: ad, usedInsight: _usedInsight)
}
@Override
public void onAdLoaded(@NonNull MaxAd ad) {
    NeftaMediationAdapter.OnExternalMediationRequestLoaded(NeftaMediationAdapter.AdType.Rewarded, ad, _usedInsight);
}
AppLovinMAX.setInterstitialListener(InterstitialListener(
  onAdLoadedCallback: (ad) {
    Nefta.onExternalMediationRequestLoaded(AdType.Interstitial, _interstitialInsight, ad);
  });

When the ad fails to load, log the response using the following function:

private void OnAdFailedEvent(string adUnitId, MaxSdkBase.ErrorInfo errorInfo)
{
    NeftaAdapterEvents.OnExternalMediationRequestFailed(NeftaAdapterEvents.AdType.Rewarded, _usedInsight, adUnitId, errorInfo);
}
- (void)didFailToLoadAdForAdUnitIdentifier:(NSString *)adUnitIdentifier withError:(MAError *)error {
    [ALNeftaMediationAdapter OnExternalMediationRequestFail: AdTypeRewarded adUnitIdentifier: adUnitIdentifier usedInsight: _usedInsight error: error];
}
func didFailToLoadAd(forAdUnitIdentifier adUnitIdentifier: String, withError error: MAError) {
    ALNeftaMediationAdapter.onExternalMediationRequestFail(.rewarded, adUnitIdentifier: adUnitIdentifier, usedInsight: _usedInsight, error: error)
}
@Override
    public void onAdLoadFailed(@NonNull String adUnitId, @NonNull MaxError maxError) {
          NeftaMediationAdapter.OnExternalMediationRequestFailed(NeftaMediationAdapter.AdType.Rewarded, adUnitId, _usedInsight, maxError);
}
AppLovinMAX.setInterstitialListener(InterstitialListener(
  onAdLoadFailedCallback: (adUnitId, error) {
    Nefta.onExternalMediationRequestFailed(AdType.Interstitial, _interstitialInsight, adUnitId, error);
  });
❗️

For best results

When making ad request to MAX with adUnitId / floorPrice form Insight object; make sure to send that insight object back in onExternalMediationRequestLoaded / onExternalMediaitonRequestFailed. So that the next insight can take this feedback into consideration.

When an ad successfully shows log the impression with this:

// By default this impression is collected automatically in Unity.
// But in case you disable this (with sendAdEvents=false in plugin Init) and send impression manually:
MaxSdkCallbacks.Rewarded.OnAdRevenuePaidEvent += (adUnitId, info) =>
{
    NeftaAdapterEvents.OnExternalMediationImpression(adUnitId, info);
};
- (void)didPayRevenueForAd:(nonnull MAAd *)ad {
    [ALNeftaMediationAdapter OnExternalMediationImpression: ad];
}
func didPayRevenue(for ad: MAAd) {
    ALNeftaMediationAdapter.onExternalMediationImpression(ad)
}
@Override
public void onAdRevenuePaid(final MaxAd ad) {
    NeftaMediationAdapter.OnExternalMediationImpression(ad);
}
AppLovinMAX.setInterstitialListener(InterstitialListener(
  onAdRevenuePaidCallback: (ad) {
    Nefta.onExternalMediationImpression(ad);
  });

Initial Ad Unit has no fill

If the initially recommended ad unit doesn't return an ad:

  • Re-request the ad insight: the new floor price takes into account the previous no-fill event and is adjusted in real time. Then request the ad again. You can repeat this process until you get fill. Please note max requires an exponential backoff delay between these retries, specified as 2, 4, 8, 16, 32, 64, 64, 64... seconds. As mentioned in the introduction, Nefta insures your ads are served within time windows you specify and balances fill %, revenue uplift and latency.