The Tenjin SDK can listen to TradPlus impression level revenue data and send revenue events to Tenjin.
Integration steps #
- Add the most recent TradPlus SDK version through your Podfile from https://docs.tradplusad.com/en/docs/integration_ios/download.
- In your TradPlus impression callback, pass the impression data to Tenjin in JSON format using the
tradPlusImpressionFromJSON:method.
Code sample #
Objective-C
- (void)tradPlusAdImpression:(NSDictionary *)adInfo {
NSDictionary *payload = @{
@"revenue" : @([adInfo[@"ecpm"] floatValue]),
@"network_name" : adInfo[@"adNetworkName"] ?: @"",
@"ad_unit_id" : adInfo[@"adunit_id"] ?: @"",
@"revenue_precision" : adInfo[@"ecpm_precision"] ?: @"",
@"format" : adInfo[@"adType"] ?: @"",
@"segment" : adInfo[@"segment_id"] ?: @"",
@"ab_test" : adInfo[@"bucket_id"] ?: @"",
@"country" : adInfo[@"country_code"] ?: @"",
@"creative_id" : adInfo[@"creativeId"] ?: @""
};
NSData *data = [NSJSONSerialization dataWithJSONObject:payload options:0 error:nil];
NSString *json = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
[TenjinSDK tradPlusImpressionFromJSON:json];
}Impression level revenue data parameters #
| Parameter | TradPlus key | Required | Example |
|---|---|---|---|
revenue | ecpm | Yes | 2.5 |
network_name | adNetworkName | No | Admob |
ad_unit_id | adunit_id | No | id-69082 |
revenue_precision | ecpm_precision | No | exact |
format | adType | No | interstitial |
segment | segment_id | No | id-2 |
ab_test | bucket_id | No | id-1 |
country | country_code | No | US |
creative_id | creativeId | No | id-41203 |
Notes #
revenueis the eCPM value, not the revenue of a single impression. Pass the TradPlusecpmvalue as-is. Tenjin divides it by 1,000 to derive the per-impression revenue. If you divide it yourself before sending, the revenue recorded in Tenjin will be 1,000 times lower than the actual value.- TradPlus reports
ecpmin USD. - Only
revenueis required. All other parameters are optional. adNetworkNamerequires TradPlus SDK v7.8.0 or later.adType,segment_idandbucket_idrequire v7.1.0 or later.creativeIdrequires v14.6.0 or later and is only returned for InMobi and Mintegral.