Enable cost data in attribution
By default, the Adtrace SDK does not include campaign cost fields in attribution data. To include these fields, enable cost data on your AdTraceConfig instance before SDK initialization.
Method signature
public void setNeedsCost(boolean needsCost)
| Parameter | Type | Description |
|---|---|---|
needsCost | boolean | Set true to request cost fields in attribution (costType, costAmount, costCurrency). |
What this enables
When cost data is enabled and available for the campaign, Adtrace can return these fields in AdTraceAttribution:
costTypecostAmountcostCurrency
If cost is not enabled, or not available for the attributed campaign, these fields are null.
Enable cost data
Call setNeedsCost(true) on your AdTraceConfig instance before AdTrace.onCreate(). See Configuration for how to create the config.
- Java
- Kotlin
- Javascript
config.setNeedsCost(true);
config.setNeedsCost(true)
config.setNeedsCost(true);