AppLovin MAX 광고 수익 연동

AppLovin MAX SDK 설치

아래 링크에 따라 AppLovin MAX SDK 를 설치해주세요.

AppLovin MAX 광고 수익 SDK to SDK 연동

아래 코드를 참고해서 AppLovin MAX SDK 의 OnAdRevenuePaidEvent 콜백에서 광고 수익 데이터를 획득해서 Airbridge SDK 에 전달해 주세요.

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);
      // AppLovin MAX has a default currency of USD
      @event.AddSemanticAttribute("currency", "USD");

      AirbridgeUnity.TrackEvent(@event);
    }
}