Applovin MAXの広告収益連携

Applovin MAX SDKのインストール

以下のリンクの内容に沿ってAppLovin MAX SDKをインストールしてください。

AppLovin MAXの広告収益のSDK to SDK連携

以下のコードを参考に、AppLovin MAX SDKのOnAdRevenuePaidEventのコールバックで広告収益データを取得し、Airbridge SDKに渡してください。

1234567891011121314151617181920212223242526272829303132333435
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);
    }
}

このページは役に立ちましたか?

ご質問やご提案はありますか?