adjust-icon

AdMob SDK 集成

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

操作前须知

  1. 配置 Adjust SDK 并将其集成至您的应用
  2. 在 AdMob 中配置展示层级广告收入 (ILAR)。请参考 Google 的说明文档

示例

- (void)requestRewardedAd {
__weak ViewController *weakSelf = self;
GADRequest *request = [GADRequest request];
[GADRewardedAd
loadWithAdUnitID:@"ad unit ID"
request:request
completionHandler:^(GADRewardedAd *ad, NSError *error) {
self.rewardedAd = ad;
self.rewardedAd.paidEventHandler = ^void(GADAdValue *_Nonnull value) {
ViewController *strongSelf = weakSelf;
// for more information, please check AdMob official docs at:
// https://developers.google.com/admob/ios/impression-level-ad-revenue
GADAdNetworkResponseInfo *loadedAdNetworkResponseInfo = strongSelf.rewardedAd.responseInfo.loadedAdNetworkResponseInfo;
// send ad revenue info to Adjust
ADJAdRevenue *adRevenue = [[ADJAdRevenue alloc]
initWithSource:@"admob_sdk"];
[adRevenue setRevenue:value.value currency:value.currencyCode];
[adRevenue setAdRevenueNetwork:loadedAdNetworkResponseInfo.adSourceName]
[Adjust trackAdRevenue:adRevenue];
}
}
];
}