Track transactions
To associate a user’s session with their potential purchases (and corresponding revenue), you must send the transaction via a dedicated API. For each transaction, we send:
- Price (mandatory)
- Currency (mandatory)
- Transaction ID (optional)
import com.contentsquare.api.model.Transactionimport com.contentsquare.api.contract.Currency
// Sends Transactionval price = 430.99fval currency: Currency = Currency.EURval id = "id"
val transaction = Transaction(price, currency, id)
CSQ.trackTransaction(transaction)
import com.contentsquare.api.model.Transaction;import com.contentsquare.api.contract.Currency;
// Sends Transactionfloat price = 430.99f;Currency currency = Currency.EUR;String id = "id";
Transaction transaction = new Transaction(price, currency, id);
CSQ.trackTransaction(transaction);
Currency
Section titled CurrencyThe currency is conforming to the ISO 4217 ↗ standard. The currency can be passed either as “alphanumeric code” or “numeric code”.
If the currency passed doesn’t match the supported currencies, the SDK will send a currency value of -1
. It will be processed as the default currency of the project.