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 to your app level
build.gradlefile from https://docs.tradplusad.com/en/docs/tradplussdk_android_doc_v6/. - In the TradPlus
onAdImpressioncallback, pass the impression data to Tenjin using theeventAdImpressionTradPlus(json)method.
Code sample #
Java
public class DemoActivity extends Activity {
private TenjinSDK tenjinInstance;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
tenjinInstance = TenjinSDK.getInstance(this, "<SDK_KEY>");
}
public void onAdImpression(TPAdInfo tpAdInfo) {
try {
JSONObject json = new JSONObject();
json.put("revenue", Double.parseDouble(tpAdInfo.ecpm));
json.put("network_name", tpAdInfo.adSourceName);
json.put("ad_unit_id", tpAdInfo.tpAdUnitId);
json.put("revenue_precision", tpAdInfo.ecpmPrecision);
json.put("format", tpAdInfo.format);
json.put("segment", tpAdInfo.segmentId);
json.put("ab_test", tpAdInfo.bucketId);
json.put("country", tpAdInfo.isoCode);
json.put("creative_id", tpAdInfo.creativeId);
tenjinInstance.eventAdImpressionTradPlus(json);
} catch (JSONException e) {
e.printStackTrace();
}
}
}Impression level revenue data parameters #
| Parameter | TradPlus field | Required | Example |
|---|---|---|---|
revenue | ecpm | Yes | 2.5 |
network_name | adSourceName | No | Admob |
ad_unit_id | tpAdUnitId | No | id-69082 |
revenue_precision | ecpmPrecision | No | exact |
format | format | No | interstitial |
segment | segmentId | No | id-2 |
ab_test | bucketId | No | id-1 |
country | isoCode | 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. - For the
revenueparameter, use double type, not string type. TradPlus returnsecpmas a string, so convert it before sending. - Only
revenueis required. All other parameters are optional. segmentIdandbucketIdrequire TradPlus SDK v7.6.0.1 or later.creativeIdrequires v15.0.0.1 or later and is only returned for InMobi and Mintegral.