MAX - Unity

Based on AppLovin MAX Unity Demo App: https://github.com/AppLovin/AppLovin-MAX-Unity-Plugin you can test the Nefta Custom adapter integration through MAX SDK https://github.com/Nefta-io/NeftaMAXAdapter-Unity:


Include the SDK

The most convenient way to include the Nefta Custom Adapter for both Android and iOS is to download the Unity package: https://github.com/Nefta-io/NeftaMAXAdapter-Unity/releases/. Which you import through Assets > Import Package > Custom Package...

After which you will be presented with the following dialog:

Feel free to customize this as much as you want, based on the needs of your project.


Code integration

To complete the integration, you have to init the SDK on app start or shortly after, to ensure proper behavior of game events:

#if UNITY_IOS
NeftaAdapterEvents.Init("your iOS AppId");
#else
NeftaAdapterEvents.Init("your Android AppId");
#endif

After this, you can create events whenever you like, for example:

new ProgressionEvent(Type.Task, Status.Start) { _name = "tutorial", _value = 1}.Record();

Mediation events

To maximize ad earning with Nefta some events are required from Max mediation. Impression events are collected automatically if you don't explicitly disable them in in NeftaAdapterEvents.Init(). You have to manually invoke OnExternalAdLoad and OnExternalAdFail for every ad type, example for banners:

MaxSdkCallbacks.Banner.OnAdLoadedEvent += OnBannerAdLoadedEvent;
MaxSdkCallbacks.Banner.OnAdLoadFailedEvent += OnBannerAdFailedEvent;

MaxSdk.CreateBanner(_adUnitId, MaxSdkBase.BannerPosition.TopCenter);
MaxSdk.ShowBanner(_adUnitId);

private void OnBannerAdLoadedEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
{
  NeftaAdapterEvents.OnExternalAdLoad(NeftaAdapterEvents.AdType.Banner, unitFloor, calculatedFloor);
}

private void OnBannerAdFailedEvent(string adUnitId, MaxSdkBase.ErrorInfo errorInfo)
{
  NeftaAdapterEvents.OnExternalAdFail(NeftaAdapterEvents.AdType.Banner, unitFloor, calculatedFloor, errorInfo);
}


Logging:

To enable logging call this function anytime during runtime:

NeftaAdapterEvents.EnableLogging(true);

On Android make sure that you're also using debug SDK version. You can change this by toggling which aar is included:


Backend Configuration

After configuring the Nefta mediation network for your placements you will start seeing and earning with Nefta ads.