以下のリンクの内容に沿ってAppLovin MAX 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);
}
}
このページは役に立ちましたか?