Tenjin SDK có thể thu thập dữ liệu doanh thu từ các lần hiển thị quảng cáo trong LevelPlay của Unity và gửi các sự kiện doanh thu đến Tenjin. Tích hợp này sẽ gửi dữ liệu doanh thu liên quan đến từng lần hiển thị quảng cáo được phân phối từ IronSource. Dưới đây là các bước để tích hợp:
- Cài đặt SDK IronSource iOS: https://developers.is.com/ironsource-mobile/ios/ios-sdk/
Vui lòng đảm bảo rằng bạn đã cài đặt phiên bản mới nhất của SDK IronSource iOS (> 7.1.14) - Hãy chuyển dữ liệu doanh thu sang Tenjin bằng cách sử dụng đoạn mã mẫu sau đây.
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);
}
}
Dưới đây là một ví dụ về việc nhập dữ liệu doanh thu theo mức hiển thị từ Unity LevelPlay:
| Tham số | Có bắt buộc không? | Ví dụ |
|---|---|---|
| auction_id | Không | 4a9fba00-a6c6-11ec-b5a2-817ec8dcf90b_1977367705 |
| tên_phân_khúc | Không | Dây |
| độ chính xác | Không | BID |
| doanh thu | Có | 0.099 |
| id_phiên_bản | Không | 4334854 |
| vị trí | Không | Banner mặc định |
| ab | Không | A |
| cpm_mã_hóa | Không | Dây |
| quốc gia | Không | DE |
| ad_unit | Không | banner |
| mạng quảng cáo | Không | ironsource |
| tên_thực_thể | Không | Đấu thầu |
Nguồn tham khảo: https://developers.is.com/ironsource-mobile/ios/ad-revenue-measurement-integration/#step-2