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 (number, mandatory)
- Currency (Currency or string, mandatory)
- Transaction ID (string, optional)
import Contentsquare, { Currency } from '@contentsquare/react-native-bridge';
// numeric currency: Contentsquare.sendTransaction(number, Currency, string?)Contentsquare.sendTransaction(10, Currency.USD);Contentsquare.sendTransaction(200, Currency.EUR, "my_transaction_1");
// alphanumeric currency: Contentsquare.sendTransactionWithStringCurrency(number, string, string?)Contentsquare.sendTransaction(10, "USD");Contentsquare.sendTransaction(200, "eur", "my_transaction_2");
Currency
Section titled CurrencyThe currency is conforming to the ISO 4217 standard. Although the currency can be passed either as “alphanumeric code” or “numeric code”, you should always prefer using the bridge’s Currency object values. If you have to pass the ISO code as a string, note that capitalization is not a factor (Currency.USD
, "USD"
, "Usd"
or "usd"
will all be treated as the US Dollar).
If the currency passed doesn’t match our supported currencies, the SDK will send a currency value of “-1”. It will be processed as the default currency of the project.