# Android – TradPlus

Source: https://tenjin.com/docs/android-tradplus/

The Tenjin SDK can listen to TradPlus impression level revenue data and send revenue events to Tenjin.


### Integration steps


1. Add the most recent TradPlus SDK version to your app level ` build.gradle ` file from [https://docs.tradplusad.com/en/docs/tradplussdk_android_doc_v6/](<https://docs.tradplusad.com/en/docs/tradplussdk_android_doc_v6/>).

2. In the TradPlus ` onAdImpression ` callback, pass the impression data to Tenjin using the ` eventAdImpressionTradPlus(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


- ` revenue ` is the eCPM value, not the revenue of a single impression. Pass the TradPlus ` ecpm ` value 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 ` ecpm ` in USD.

- For the ` revenue ` parameter, use double type, not string type. TradPlus returns ` ecpm ` as a string, so convert it before sending.

- Only ` revenue ` is required. All other parameters are optional.

- ` segmentId ` and ` bucketId ` require TradPlus SDK v7.6.0.1 or later. ` creativeId ` requires v15.0.0.1 or later and is only returned for InMobi and Mintegral.
