AppLovin MAX

AppLovin MAX SDK 安装

请参阅 AppLovin MAX 文档 安装 AppLovin MAX SDK。

提示

此功能处于测试阶段。 如有疑问或功能需求,请联系您的 CSM。

传递 AppLovin MAX 广告收入数据至 Airbridge 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);
    }
}

Was this page helpful?

Have any questions or suggestions?