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.Transaction
import com.contentsquare.api.contract.Currency
val transaction = Transaction(430.99f, Currency.EUR, "my_id")
CSQ.trackTransaction(transaction)

The Currency enum provides a list of all supported currencies, conforming to the ISO 4217 standard.

import com.contentsquare.api.contract.Currency
val currency = Currency.USD
val currencyFromString = Currency.fromString("USD")
val currencyFromInteger = Currency.fromInteger(840)
// string or integer ISO code can also be retrieved from the enum value
Currency.USD.stringCode // "USD"
Currency.USD.integerCode // 840