The Tenjin SDK can listen to Unity LevelPlay impression level revenue data and send revenue events to Tenjin. This integration will send revenue related for each ad impression served from IronSource. Here are the steps to integrate:
- Установите the IronSource iOS SDK: https://developers.is.com/ironsource-mobile/ios/ios-sdk/
<aside> 💡
Please ensure you have the latest IronSource iOS SDK installed (> 7.1.14)
</aside>
- Pass the revenue data to Tenjin, using the following sample code.
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);
}
}
Here is an example impression level revenue data entry from Unity LevelPlay:
| Parameter | Required? | Example |
|---|---|---|
| auction_id | Нет | 4a9fba00-a6c6-11ec-b5a2-817ec8dcf90b_1977367705 |
| segment_name | Нет | String |
| precision | Нет | BID |
| выручка | Да | 0.099 |
| instance_id | Нет | 4334854 |
| placement | Нет | DefaultBanner |
| ab | Нет | A |
| encrypted_cpm | Нет | String |
| country | Нет | DE |
| ad_unit | Нет | banner |
| ad_network | Нет | ironsource |
| instance_name | Нет | Bidding |
reference: