adjust-icon

TradPlus SDK 集成

如果您想使用 TradPlus SDK 监测广告收入,可以借助 SDK 到 SDK 集成,将数据发送到 Adjust 服务器。

操作前须知

要将 Adjust SDK 集成进应用,请按集成指南中的说明操作。

示例

如需通过 Adjust 记录广告收入信息,请在TPGlobalAdImpressionListener函数中创建一个AdjustAdRevenue实例。请参阅发送广告收入信息指南了解更多信息。

static TPGlobalAdImpressionListener? globalAdImpressionListener;
globalAdImpressionListener = TPGlobalAdImpressionListener(onGlobalAdImpression: (adInfo) {
AdjustAdRevenue revenue = AdjustAdRevenue('tradplus_sdk');
String adUnitId;
String networkName;
String adType;
if (defaultTargetPlatform == TargetPlatform.iOS) {
adUnitId = adInfo['adunit_id'].toString();
networkName = adInfo['adNetworkName'].toString();
adType = adInfo['adType'].toString();
}
else {
adUnitId = adInfo['tpAdUnitId'].toString();
networkName = adInfo['adSourceName'].toString();
adType = adInfo['format'].toString();
}
String ecpmStr = adInfo['ecpm'].toString();
num revenueNum = num.parse(ecpmStr)/1000.0;
revenue.setRevenue(revenueNum, 'USD');
revenue.adRevenueNetwork = networkName;
revenue.adRevenuePlacement = adType;
revenue.adRevenueUnit = adUnitId;
Adjust.trackAdRevenue(revenue);
});
TPSDKManager.setGlobalAdImpressionListener(globalAdImpressionListener!);