提示
此功能处于测试阶段。 如有疑问或功能需求,请联系您的 CSM。
Airbridge supports the SDK integration with TradPlus. With the integration, you can import ad revenue data from TradPlus to Airbridge.
Click the link below and install the TradPlus SDK.
Configure data callbacks in the TradPlus SDK to send ad revenue data to the Airbridge SDK.
TradplusAds.Instance().AddGlobalAdImpression(OnGlobalAdImpression);
// ...
void OnGlobalAdImpression(Dictionary<string, object> adInfo)
{
string adPlatform = "TradPlus";
var adNetwork = "";
var adUnit = "";
var adFormat = "";
#if UNITY_IOS
adNetwork = adInfo["adNetworkName"] as string;
adUnit = adInfo["adunit_id"] as string;
adFormat = adInfo["adType"] as string;
#else
adNetwork = adInfo["adSourceName"] as string;
adUnit = adInfo["tpAdUnitId"] as string;
adFormat = adInfo["format"] as string;
#endif
var currency = "USD";
var revenue = double.Parse(adInfo["ecpm"] as string, System.Globalization.CultureInfo.InvariantCulture) / 1000;
AirbridgeEvent @event = new AirbridgeEvent("airbridge.adImpression");
var tradPlus = new Dictionary<string, object>();
tradPlus["ad_platform"] = adPlatform;
tradPlus["ad_network"] = adNetwork;
tradPlus["ad_unit"] = adUnit;
tradPlus["ad_format"] = adFormat;
tradPlus["value"] = revenue;
var adPartners = new Dictionary<string, object>();
adPartners["tradPlus"] = tradPlus;
@event.SetAction(adUnit);
@event.SetLabel(adFormat);
@event.SetValue(revenue);
@event.AddSemanticAttribute("adPartners", adPartners);
@event.AddSemanticAttribute("currency", currency);
AirbridgeUnity.TrackEvent(@event);
}
let adPlatform = "TradPlus"
guard let adNetwork = adInfo["adNetworkName"] as? String else { return }
guard let adUnit = adInfo["adunit_id"] as? String else { return }
guard let adFormat = adInfo["adType"] as? String else { return }
guard let currency = "USD"
guard let ecpm = adInfo["ecpm"] as? String else { return }
let revenue = NSNumber(value: (Float(ecpm) ?? 0) / 1000.0)
let event = ABInAppEvent()
event?.setCategory("airbridge.adImpression")
event?.setAction(adNetwork)
event?.setLabel(adFormat)
event?.setValue(revenue)
event?.setSemantics([
"adPartners": [
"tradPlus": [
"ad_platform": adPlatform,
"ad_network": adNetwork,
"ad_unit": adUnit,
"ad_format": adFormat,
"value": revenue
]
],
"currency": currency
])
event?.send()
- (void)tradPlusAdImpression:(NSDictionary *)adInfo
{
NSString* adPlatform = @"TradPlus";
NSString* adNetwork = adInfo[@"adNetworkName"];
NSString* adUnit = adInfo[@"adunit_id"];
NSString* adFormat = adInfo[@"adType"];
NSString* currency = @"USD";
NSNumber *revenue = [NSNumber numberWithFloat: [adInfo[@"ecpm"] floatValue]/1000.0];
ABInAppEvent* event = [[ABInAppEvent alloc] init];
[event setCategory:@"airbridge.adImpression"];
[event setAction:adNetwork];
[event setLabel:adFormat];
[event setValue:revenue];
[event setSemantics:@{
@"adPartners": @{
@"tradPlus": @{
@"ad_platform": adPlatform,
@"ad_network": adNetwork,
@"ad_unit": adUnit,
@"ad_format": adFormat,
@"value": revenue
}
},
@"currency": currency
}];
[event send];
}
TradPlusSdk.setGlobalImpressionListener { tpAdInfo ->
if (tpAdInfo != null) {
val adPlatform = "TradPlus"
val adNetwork = tpAdInfo.adSourceName
val adUnit = tpAdInfo.tpAdUnitId
val adFormat = tpAdInfo.format
val currency = "USD"
val revenue = tpAdInfo.ecpm.toDouble() / 1000
val event = Event("airbridge.adImpression")
val tradPlus = mutableMapOf<String, Any?>()
tradPlus["ad_platform"] = adPlatform
tradPlus["ad_network"] = adNetwork
tradPlus["ad_unit"] = adUnit
tradPlus["ad_format"] = adFormat
tradPlus["value"] = revenue
val adPartners = mapOf("tradPlus" to tradPlus)
event.action = adNetwork
event.label = adFormat
event.value = revenue
event.semanticAttributes = mutableMapOf(
"adPartners" to adPartners,
"currency" to currency
)
trackEvent(event)
}
}
TradPlusSdk.setGlobalImpressionListener(new GlobalImpressionManager.GlobalImpressionListener() {
@Override
public void onImpressionSuccess(TPAdInfo tpAdInfo) {
if (tpAdInfo != null) {
String adPlatform = "TradPlus";
String adNetwork = tpAdInfo.adSourceName;
String adUnit = tpAdInfo.tpAdUnitId;
String adFormat = tpAdInfo.format;
String currency = "USD";
double revenue = Double.parseDouble(tpAdInfo.ecpm) / 1000;
Event event = new Event("airbridge.adImpression");
Map<String, Object> tradPlus = new HashMap<>();
tradPlus.put("ad_platform", adPlatform);
tradPlus.put("ad_network", adNetwork);
tradPlus.put("ad_unit", adUnit);
tradPlus.put("ad_format", adFormat);
tradPlus.put("value", revenue);
Map<String, Object> adPartners = new HashMap<>();
adPartners.put("tradPlus", tradPlus);
Map<String, Object> semanticAttributes = new HashMap<>();
semanticAttributes.put("adPartners", adPartners);
semanticAttributes.put("currency", currency);
event.setAction(adNetwork);
event.setLabel(adFormat);
event.setValue(revenue);
event.setSemanticAttributes(semanticAttributes);
Airbridge.trackEvent(event);
}
}
});
Was this page helpful?
TradPlusSdk.setGlobalImpressionListener { tpAdInfo ->
if (tpAdInfo != null) {
val adPlatform = "TradPlus"
val adNetwork = tpAdInfo.adSourceName
val adUnit = tpAdInfo.tpAdUnitId
val adFormat = tpAdInfo.format
val currency = "USD"
val revenue = tpAdInfo.ecpm.toDouble() / 1000
val event = Event("airbridge.adImpression")
val tradPlus = mutableMapOf<String, Any?>()
tradPlus["ad_platform"] = adPlatform
tradPlus["ad_network"] = adNetwork
tradPlus["ad_unit"] = adUnit
tradPlus["ad_format"] = adFormat
tradPlus["value"] = revenue
val adPartners = mapOf("tradPlus" to tradPlus)
event.action = adNetwork
event.label = adFormat
event.value = revenue
event.semanticAttributes = mutableMapOf(
"adPartners" to adPartners,
"currency" to currency
)
trackEvent(event)
}
}
TradPlusSdk.setGlobalImpressionListener(new GlobalImpressionManager.GlobalImpressionListener() {
@Override
public void onImpressionSuccess(TPAdInfo tpAdInfo) {
if (tpAdInfo != null) {
String adPlatform = "TradPlus";
String adNetwork = tpAdInfo.adSourceName;
String adUnit = tpAdInfo.tpAdUnitId;
String adFormat = tpAdInfo.format;
String currency = "USD";
double revenue = Double.parseDouble(tpAdInfo.ecpm) / 1000;
Event event = new Event("airbridge.adImpression");
Map<String, Object> tradPlus = new HashMap<>();
tradPlus.put("ad_platform", adPlatform);
tradPlus.put("ad_network", adNetwork);
tradPlus.put("ad_unit", adUnit);
tradPlus.put("ad_format", adFormat);
tradPlus.put("value", revenue);
Map<String, Object> adPartners = new HashMap<>();
adPartners.put("tradPlus", tradPlus);
Map<String, Object> semanticAttributes = new HashMap<>();
semanticAttributes.put("adPartners", adPartners);
semanticAttributes.put("currency", currency);
event.setAction(adNetwork);
event.setLabel(adFormat);
event.setValue(revenue);
event.setSemanticAttributes(semanticAttributes);
Airbridge.trackEvent(event);
}
}
});