AppLovin MAX Ad Revenue Integration

AppLovin MAX SDK Installation

Please refer to the below guide for AppLovin MAX SDK installation.



AppLovin MAX Ad Revenue SDK to SDK Integration

Please refer to the below code and send ad revenue data to the Airbridge SDK through the AppLovin MAX SDK's OnAdRevenuePaidEvent callback.

private void OnEnable() {
    MaxSdkCallbacks.Banner.OnAdRevenuePaidEvent += OnAdRevenuePaidEvent;
    MaxSdkCallbacks.Interstitial.OnAdRevenuePaidEvent += OnAdRevenuePaidEvent;
    MaxSdkCallbacks.Rewarded.OnAdRevenuePaidEvent += OnAdRevenuePaidEvent;
    MaxSdkCallbacks.RewardedInterstitial.OnAdRevenuePaidEvent += OnAdRevenuePaidEvent;
    MaxSdkCallbacks.MRec.OnAdRevenuePaidEvent += OnAdRevenuePaidEvent;
}

private void OnAdRevenuePaidEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
{
    if (adInfo != null) {
      AirbridgeEvent @event = new AirbridgeEvent("airbridge.adImpression");

      var appLovin = new Dictionary<string, object>();
      appLovin["revenue"] = adInfo.Revenue;
      appLovin["country_code"] = MaxSdk.GetSdkConfiguration().CountryCode;
      appLovin["network_name"] = adInfo.NetworkName;
      appLovin["network_placement"] = adInfo.NetworkPlacement;
      appLovin["adunit_identifier"] = adInfo.AdUnitIdentifier;
      appLovin["creative_identifier"] = adInfo.CreativeIdentifier;
      appLovin["placement"] = adInfo.Placement;

      var adPartners = new Dictionary<string, object>();
      adPartners["appLovin"] = appLovin;

      @event.SetAction(adInfo.NetworkName);
      @event.SetLabel(adInfo.NetworkPlacement);
      @event.SetValue(adInfo.Revenue);
      @event.AddSemanticAttribute("adPartners", adPartners);

      AirbridgeUnity.TrackEvent(@event);
    }
}