TradPlus SDK 集成 如果您想使用 TradPlus SDK 监测广告收入,可以借助 SDK 到 SDK 集成,将数据发送到 Adjust 服务器。 操作前须知 要将 Adjust SDK 集成进应用,请按集成指南中的说明操作。 示例 如需通过 Adjust 记录广告收入信息,请在TPGlobalAdImpressionListener函数中创建一个AdjustAdRevenue实例。请参阅发送广告收入信息指南了解更多信息。 1static TPGlobalAdImpressionListener? globalAdImpressionListener;2 3globalAdImpressionListener = TPGlobalAdImpressionListener(onGlobalAdImpression: (adInfo) {4 AdjustAdRevenue revenue = AdjustAdRevenue('tradplus_sdk');5 String adUnitId;6 String networkName;7 String adType;8 if (defaultTargetPlatform == TargetPlatform.iOS) {9 adUnitId = adInfo['adunit_id'].toString();10 networkName = adInfo['adNetworkName'].toString();11 adType = adInfo['adType'].toString();12 }13 else {14 adUnitId = adInfo['tpAdUnitId'].toString();15 networkName = adInfo['adSourceName'].toString();16 adType = adInfo['format'].toString();17 }18 String ecpmStr = adInfo['ecpm'].toString();19 num revenueNum = num.parse(ecpmStr)/1000.0;20 revenue.setRevenue(revenueNum, 'USD');21 revenue.adRevenueNetwork = networkName;22 revenue.adRevenuePlacement = adType;23 revenue.adRevenueUnit = adUnitId;24 25 Adjust.trackAdRevenue(revenue);26});27 28TPSDKManager.setGlobalAdImpressionListener(globalAdImpressionListener!);