Tenjin SDKはUnity LevelPlayのインプレッションレベルの収益データをリッスンし、収益イベントをTenjinに送信できます。この連携により、IronSourceから配信された各広告インプレッションに関連する収益が送信されます。連携の手順は以下のとおりです。
- IronSource iOS SDKをインストールします: https://developers.is.com/ironsource-mobile/ios/ios-sdk/
最新のIronSource iOS SDK(バージョン7.1.14以降)がインストールされていることを確認してください。 - 以下のサンプルコードを使用して、収益データをTenjinに連携してください。
Objective-C #
Objective-C
/**
Invoked when the ad was displayed successfully and the impression data was recorded **/
- (void)impressionDataDidSucceed:(ISImpressionData *)impressionData {
NSLog(@"%s", __PRETTY_FUNCTION__);
// Create JSON object for Tenjin
NSDictionary *impressionDict = @{
@"auction_id": impressionData.auction_id ?: @"",
@"segment_name": impressionData.segment_name ?: @"",
@"precision": impressionData.precision ?: @"",
@"revenue": impressionData.revenue ?: @0,
@"instance_id": impressionData.instance_id ?: @"",
@"lifetime_revenue": impressionData.lifetime_revenue ?: @0,
@"placement": impressionData.placement ?: @"",
@"ab": impressionData.ab ?: @"",
@"encrypted_cpm": impressionData.encrypted_cpm ?: @"",
@"country": impressionData.country ?: @"",
@"ad_unit": impressionData.ad_unit ?: @"",
@"ad_network": impressionData.ad_network ?: @"",
@"instance_name": impressionData.instance_name ?: @""
};
// Convert to JSON string
NSError *error;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:impressionDict
options:0
error:&error];
if (jsonData && !error) {
NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
// Send to Tenjin
[TenjinSDK ironSourceImpressionFromJSON:jsonString];
NSLog(@"Sent IronSource impression to Tenjin: %@", jsonString);
} else {
NSLog(@"Error creating JSON: %@", error.localizedDescription);
}
}
以下は、Unity LevelPlayにおけるインプレッションレベルの収益データ入力例です。
| パラメータ | 必須? | 例 |
|---|---|---|
| auction_id | いいえ | 4a9fba00-a6c6-11ec-b5a2-817ec8dcf90b_1977367705 |
| segment_name | いいえ | String |
| precision | いいえ | BID |
| revenue | はい | 0.099 |
| instance_id | いいえ | 4334854 |
| placement | いいえ | DefaultBanner |
| ab | いいえ | - |
| encrypted_cpm | いいえ | String |
| country | いいえ | DE |
| ad_unit | いいえ | banner |
| ad_network | いいえ | ironsource |
| instance_name | いいえ | Bidding |
参照: https://developers.is.com/ironsource-mobile/ios/ad-revenue-measurement-integration/#step-2