提示
此功能处于测试阶段。 如有疑问或功能需求,请联系您的 CSM。
Airbridge supports the SDK integration with AD(X). With the integration, you can import ad revenue data from AD(X) to Airbridge.
Click the link below and install the AD(X) SDK.
Configure data callbacks in the AD(X) SDK to send ad revenue data to the Airbridge SDK.
rewardedAd.OnPaidEvent += RewardedAd_OnPaidEvent;
void RewardedAd_OnPaidEvent(double ecpm)
{
var revenue = ecpm / 1000f;
var adPlatform = "AD(X)";
var adUnitID = "<ADX_BANNER_AD_UNIT_ID>";
var adUnitName = "ADX Rewarded Ad";
var adFormat = "RewardedAd";
var currency = "USD";
Airbridge.TrackEvent(
category: AirbridgeCategory.AD_IMPRESSION,
semanticAttributes: new Dictionary<string, object>()
{
{ AirbridgeAttribute.ACTION, adUnitName },
{ AirbridgeAttribute.LABEL, adFormat },
{ AirbridgeAttribute.VALUE, revenue },
{
AirbridgeAttribute.AD_PARTNERS, new Dictionary<string, object>()
{
{
"adx", new Dictionary<string, object>()
{
{ "ad_platform", adPlatform },
{ "ad_unit_id", adUnitID },
{ "ad_unit_name", adUnitName },
{ "ad_format", adFormat },
{ "value", revenue },
{ "currency", currency }
}
}
}
},
{ AirbridgeAttribute.CURRENCY, currency }
}
);
}
rewardedAd.OnPaidEvent += RewardedAd_OnPaidEvent;
void RewardedAd_OnPaidEvent(double ecpm)
{
var revenue = ecpm / 1000f;
var adPlatform = "AD(X)";
var adUnitID = "<ADX_BANNER_AD_UNIT_ID>";
var adUnitName = "ADX Rewarded Ad";
var adFormat = "RewardedAd";
var currency = "USD";
AirbridgeEvent @event = new AirbridgeEvent("airbridge.adImpression");
var adx = new Dictionary<string, object>();
adx["ad_platform"] = adPlatform;
adx["ad_unit_id"] = adUnitID;
adx["ad_unit_name"] = adUnitName;
adx["ad_format"] = adFormat;
adx["value"] = revenue;
adx["currency"] = currency;
var adPartners = new Dictionary<string, object>();
adPartners["adx"] = adx;
@event.SetAction(adUnitName);
@event.SetLabel(adFormat);
@event.SetValue(revenue);
@event.AddSemanticAttribute("adPartners", adPartners);
@event.AddSemanticAttribute("currency", currency);
AirbridgeUnity.TrackEvent(@event);
}
rewardedAd.paidEventHandler = { eCPM in
let revenue = eCPM / 1000
let adPlatform = "AD(X)"
let adUnitID = "<ADX_BANNER_AD_UNIT_ID>"
let adUnitName = "ADX Rewarded Ad"
let adFormat = "RewardedAd"
let currency = "USD"
Airbridge.trackEvent(
category: AirbridgeCategory.AD_IMPRESSION,
semanticAttributes: [
AirbridgeAttribute.ACTION: adUnitName,
AirbridgeAttribute.LABEL: adFormat,
AirbridgeAttribute.VALUE: revenue,
AirbridgeAttribute.AD_PARTNERS: [
"adx": [
"ad_platform": adPlatform,
"ad_unit_id": adUnitID,
"ad_unit_name": adUnitName,
"ad_format": adFormat,
"value": revenue,
"currency": currency
]
],
AirbridgeAttribute.CURRENCY: currency
]
)
}
self.rewardedAd.paidEventHandler = ^(double eCPM) {
double revenue = eCPM / 1000;
NSString* adPlatform = "AD(X)";
NSString* adUnitID = "<ADX_BANNER_AD_UNIT_ID>";
NSString* adUnitName = "ADX Rewarded Ad";
NSString* adFormat = "RewardedAd";
NSString* currency = "USD";
[Airbridge trackEventWithCategory:AirbridgeCategory.AD_IMPRESSION semanticAttributes:@{
AirbridgeAttribute.ACTION: adUnitName,
AirbridgeAttribute.LABEL: adFormat,
AirbridgeAttribute.VALUE: @(revenue),
AirbridgeAttribute.AD_PARTNERS: @{
@"adx": @{
@"ad_platform": adPlatform,
@"ad_unit_id": adUnitID,
@"ad_unit_name": adUnitName,
@"ad_format": adFormat,
@"value": @(revenue),
@"currency": currency
}
},
@"currency": currency
}];
};
rewardedAd.paidEventHandler = { eCPM in
let revenue = eCPM / 1000
let adPlatform = "AD(X)"
let adUnitID = "<ADX_BANNER_AD_UNIT_ID>"
let adUnitName = "ADX Rewarded Ad"
let adFormat = "RewardedAd"
let currency = "USD"
let event = ABInAppEvent()
event?.setCategory("airbridge.adImpression")
event?.setAction(adUnitName)
event?.setLabel(adFormat)
event?.setValue(revenue)
event?.setSemantics([
"adPartners": [
"adx": [
"ad_platform": adPlatform,
"ad_unit_id": adUnitID,
"ad_unit_name": adUnitName,
"ad_format": adFormat,
"value": revenue,
"currency": currency
]
],
"currency": currency
])
event?.send()
}
self.rewardedAd.paidEventHandler = ^(double eCPM) {
double revenue = eCPM / 1000;
NSString* adPlatform = "AD(X)";
NSString* adUnitID = "<ADX_BANNER_AD_UNIT_ID>";
NSString* adUnitName = "ADX Rewarded Ad";
NSString* adFormat = "RewardedAd";
NSString* currency = "USD";
ABInAppEvent* event = [[ABInAppEvent alloc] init];
[event setCategory:@"airbridge.adImpression"];
[event setAction:adUnitName];
[event setLabel:adFormat];
[event setValue:revenue];
[event setSemantics:@{
@"adPartners": @{
@"adx": @{
@"ad_platform": adPlatform,
@"ad_unit_id": adUnitID,
@"ad_unit_name": adUnitName,
@"ad_format": adFormat,
@"value": @(revenue),
@"currency": currency
}
},
@"currency": currency
}];
[event send];
};
rewardedAd.setOnPaidEventListener(object : OnPaidEventListener() {
fun onPaidEvent(ecpm: Double) {
val revenue = ecpm / 1000
val adPlatform = "AD(X)"
val adUnitID = "<ADX_BANNER_AD_UNIT_ID>"
val adUnitName = "ADX Rewarded Ad"
val adFormat = "RewardedAd"
val currency = "USD"
Airbridge.trackEvent(
AirbridgeCategory.AD_IMPRESSION,
mapOf(
AirbridgeAttribute.ACTION to adUnitName,
AirbridgeAttribute.LABEL to adFormat,
AirbridgeAttribute.VALUE to revenue,
AirbridgeAttribute.AD_PARTNERS to mapOf(
"adx" to mapOf(
"ad_platform" to adPlatform,
"ad_unit_id" to adUnitID,
"ad_unit_name" to adUnitName,
"ad_format" to adFormat,
"value" to revenue,
"currency" to currency
)
),
AirbridgeAttribute.CURRENCY to currency
)
)
}
})
rewardedAd.setOnPaidEventListener(new OnPaidEventListener() {
@Override
public void onPaidEvent(double ecpm) {
double revenue = ecpm / 1000;
String adPlatform = "AD(X)";
String adUnitID = "<ADX_BANNER_AD_UNIT_ID>";
String adUnitName = "ADX Rewarded Ad";
String adFormat = "RewardedAd";
String currency = "USD";
Airbridge.trackEvent(
AirbridgeCategory.AD_IMPRESSION,
new HashMap() {{
put(AirbridgeAttribute.ACTION, adUnitName);
put(AirbridgeAttribute.LABEL, adFormat);
put(AirbridgeAttribute.VALUE, revenue);
put(AirbridgeAttribute.AD_PARTNERS, new HashMap() {{
put("adx", new HashMap() {{
put("ad_platform", adPlatform);
put("ad_unit_id", adUnitID);
put("ad_unit_name", adUnitName);
put("ad_format", adFormat);
put("value", revenue);
put("currency", currency);
}});
}});
put(AirbridgeAttribute.CURRENCY, currency);
}}
);
}
});
rewardedAd.setOnPaidEventListener(object : OnPaidEventListener() {
fun onPaidEvent(ecpm: Double) {
val revenue = ecpm / 1000
val adPlatform = "AD(X)"
val adUnitID = "<ADX_BANNER_AD_UNIT_ID>"
val adUnitName = "ADX Rewarded Ad"
val adFormat = "RewardedAd"
val currency = "USD"
val event = Event("airbridge.adImpression")
val adx = mutableMapOf<String, Any?>()
adx["ad_platform"] = adPlatform
adx["ad_unit_id"] = adUnitID
adx["ad_unit_name"] = adUnitName
adx["ad_format"] = adFormat
adx["value"] = revenue
adx["currency"] = currency
val adPartners = mapOf("adx" to adx)
event.action = adUnitName
event.label = adFormat
event.value = revenue
event.semanticAttributes = mutableMapOf(
"adPartners" to adPartners,
"currency" to currency
)
Airbridge.trackEvent(event)
}
})
rewardedAd.setOnPaidEventListener(new OnPaidEventListener() {
@Override
public void onPaidEvent(double ecpm) {
double revenue = ecpm / 1000;
String adPlatform = "AD(X)";
String adUnitID = "<ADX_BANNER_AD_UNIT_ID>";
String adUnitName = "ADX Rewarded Ad";
String adFormat = "RewardedAd";
String currency = "USD";
Event event = Event("airbridge.adImpression");
Map<String, Object> adx = new HashMap<>();
adx.put("ad_platform", adPlatform);
adx.put("ad_unit_id", adUnitID);
adx.put("ad_unit_name", adUnitName);
adx.put("ad_format", adFormat);
adx.put("value", revenue);
adx.put("currency", currency);
Map<String, Object> adPartners = new HashMap<>();
adPartners.put("adx", adx);
Map<String, Object> semanticAttributes = new HashMap<>();
semanticAttributes.put("adPartners", adPartners);
semanticAttributes.put("currency", currency);
event.setAction(adUnitName);
event.setLabel(adFormat);
event.setValue(revenue);
event.setSemanticAttributes(semanticAttributes);
Airbridge.trackEvent(event);
}
});
Was this page helpful?