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:

  • Transaction ID
  • Revenue
  • Currency
window._uxa = window._uxa || [];
window._uxa.push([
"ec:transaction:create",
{
id: "123" /* Transaction ID (string, up to 40 chararacters) */,
revenue:
"9.99" /* Transaction's total cost (integer or string, up to 12 digits and 2 decimals - extra decimals are truncated) */,
currency:
"usd" /* Currency value (string less than 10 characters or numeric/alphanumeric ISO 4217 value) */,
},
]);
window._uxa.push(["ec:transaction:send"]);

The currency is conforming to the ISO 4217 standard](https://www.iso.org/iso-4217-currency-codes.html).
The currency must be passed as an “alphanumeric code”.

If the currency doesn’t match the supported currencies, the SDK sends a currency value of -1.
It will be processed as the default currency of the project.