# Unity Plugin – TradPlus

Source: https://tenjin.com/docs/unity-plugin-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 from [https://docs.tradplusad.com/en/docs/doc_u3d/u3d_download/](<https://docs.tradplusad.com/en/docs/doc_u3d/u3d_download/>).

2. In your TradPlus impression callback, pass the impression data to Tenjin in JSON format using the ` TradPlusImpressionFromJSON(string json) ` method.


### Code sample


TradPlus uses different key names on Android and iOS, so the payload is built per platform.


C#

```
private void OnTradPlusAdImpression(Dictionary<string, object> tpAdInfo)
{
    var payload = new Dictionary<string, object>
    {
        ["revenue"] = double.Parse(tpAdInfo["ecpm"].ToString()),
#if UNITY_IOS
        ["network_name"] = tpAdInfo["adNetworkName"],
        ["ad_unit_id"] = tpAdInfo["adunit_id"],
        ["revenue_precision"] = tpAdInfo["ecpm_precision"],
        ["format"] = tpAdInfo["adType"],
        ["segment"] = tpAdInfo["segment_id"],
        ["ab_test"] = tpAdInfo["bucket_id"],
        ["country"] = tpAdInfo["country_code"],
#else
        ["network_name"] = tpAdInfo["adSourceName"],
        ["ad_unit_id"] = tpAdInfo["tpAdUnitId"],
        ["revenue_precision"] = tpAdInfo["ecpmPrecision"],
        ["format"] = tpAdInfo["format"],
        ["segment"] = tpAdInfo["segmentId"],
        ["ab_test"] = tpAdInfo["bucketId"],
        ["country"] = tpAdInfo["isoCode"],
        ["creative_id"] = tpAdInfo["creativeId"],
#endif
    };

    Tenjin.getInstance("<SDK_KEY>").TradPlusImpressionFromJSON(JsonMapper.ToJson(payload));
}
```


### Impression level revenue data parameters


| Parameter | TradPlus key (Android) | TradPlus key (iOS) | Required | Example |
| --- | --- | --- | --- | --- |
| ` revenue ` | ` ecpm ` | ` ecpm ` | Yes | 2.5 |
| ` network_name ` | ` adSourceName ` | ` adNetworkName ` | No | Admob |
| ` ad_unit_id ` | ` tpAdUnitId ` | ` adunit_id ` | No | id-69082 |
| ` revenue_precision ` | ` ecpmPrecision ` | ` ecpm_precision ` | No | exact |
| ` format ` | ` format ` | ` adType ` | No | interstitial |
| ` segment ` | ` segmentId ` | ` segment_id ` | No | id-2 |
| ` ab_test ` | ` bucketId ` | ` bucket_id ` | No | id-1 |
| ` country ` | ` isoCode ` | ` country_code ` | No | US |
| ` creative_id ` | ` creativeId ` | not available | 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.

- ` creative_id ` is only returned for InMobi and Mintegral, and requires TradPlus Android SDK v15.0.0.1 or later.
