Unity SDK 集成 如果您想使用 Unity SDK 监测广告收入,可以借助 SDK 到 SDK 集成,将数据发送到 Adjust 服务器。 操作前须知 要使用该功能,请先为您的应用下载并设置对应的 Adjust iOS SDK。 要求 安卓 SDK 4.29.7 及更新版本 要了解更多信息,请查看 Unity Mediation API和展示事件文档。 示例 Objective-C 1@interface ViewController()2 3@property(nonatomic, strong) UMSImpressionListenerWithBlocks * listener;4 5@end6 7@implementation ViewController8 9- (void) viewDidLoad {10 [super viewDidLoad];11 12 self.listener = [[UMSImpressionListenerWithBlocks alloc] init];13 self.listener.onImpressionBlock = ^ (NSString *adUnitId, UMSImpressionData *impressionData) {14 if (impressionData) {15 NSLog(@ "impressionData: %@", [impressionData getJsonRepresentation]);16 // send impression data to Adjust17 ADJAdRevenue *adjustAdRevenue = [[ADJAdRevenue alloc] initWithSource:ADJAdRevenueSourceUnity];18 adjustAdRevenue.setRevenue([impressionData.revenue doubleValue], impressionData.currency);19 // optional fields20 adjustAdRevenue.setAdRevenueNetwork(impressionData.adSourceName);21 adjustAdRevenue.setAdRevenueUnit(impressionData.adUnitId);22 adjustAdRevenue.setAdRevenuePlacement(impressionData.adSourceInstance);23 // Send Adjust ad revenue24 Adjust.trackAdRevenue(adjustAdRevenue);25 } else {26 NSLog(@ "Data does not exist due to not enabling User-Level Reporting");27 }28 };29 [UMSImpressionEventPublisher subscribe: self.listener];30}31 32@end