Skip to Content
iAdvizeDocs
Other platforms

The transaction command

Report each completed order from your confirmation page with iadvize('transaction', { orderRef, amount, currency }), on any platform. The fields and their rules, what is sent, how to check it worked, and its limits.

On a store that is not on Shopify, you report each completed order with one call to the tag, on your order confirmation page:

iadvize('transaction', {
  orderRef: 'ORD-10432',
  amount: '129.90',
  currency: 'EUR',
})

Call it on every completed order, whether or not the shopper talked to the agent. The orders without a conversation give your site's total, the ones with a conversation give the agent's share. If the shopper's browser holds a conversation key, the tag sends it with the order for you. You never read or pass the key yourself.

On Shopify, the pixel reports every order already. Orders are deduplicated on orderRef only, so a second sender with another reference for the same order records it twice.

Before you start

  • The install snippet runs on your order confirmation page, as on your other pages. The command is part of the tag.
  • Record orders from your store is on in Site settings > Site access (on by default). See The two switches.

Add the call

Place the call where your platform renders the confirmation page, with the values of the order just placed. Most platforms expose them to the confirmation template or to the data layer. For example, from a template variable:

<script>
  iadvize('transaction', {
    orderRef: '{{ order.number }}',
    amount: '{{ order.subtotal }}',
    currency: '{{ order.currency }}',
  })
</script>

{{ order.number }} and the rest stand for your platform's own template variables: use the names your platform gives.

You can call it before the tag has finished loading. Like every command, the call is queued and sent once the tag boots.

The fields

All three are required.

FieldWhat to pass
orderRefYour own order id, as a string or a number, 1 to 200 characters, not only spaces. A number is sent as a string. The agent keeps the first order received for a reference and drops the later ones, so pass the same id each time for the same order.
amountThe order total in the currency's major units. As a string: digits with an optional decimal part after a dot, 32 characters at most ('129.90', '1500'). As a number: any finite number of 0 or more (129.9). No sign, no comma, no currency symbol, no space.
currencyA three-letter ISO 4217 code, in any case ('EUR', 'eur'). A code the platform does not know is dropped by the agent.

Choose what amount covers (with or without tax, with or without shipping) and keep it the same on every order: the agent stores what you send and compares it over time. It converts to the currency's minor units, so '129.90' in EUR is stored as 12990, rounded to the currency's own number of decimals.

A call the tag refuses

When a field breaks these rules, the tag sends nothing and writes one warning in the browser console, naming the first field it refused:

[iadvize] transaction ignored: invalid amount

The warning names orderRef, amount or currency. The call never throws, so a bad value never breaks your page. A currency of three letters that no ISO code matches passes the tag and is dropped by the agent without a warning, and so is an amount too large to store once converted (see Amounts).

What is sent

One purchase to the public orders endpoint of your site, with:

  • orderRef, amount and currency, as you passed them (orderRef as a string);
  • the tag's session key, when the browser tab holds one;
  • the conversation key from the iadvize_atr_<site key> cookie, when there is one.

No time is sent: the agent dates the order when it receives it. Nothing that identifies the shopper is sent: no name, email, address, cart line or payment field.

The tag sends it with the browser's beacon API, so the request survives a navigation right after the call. When the browser refuses the beacon, it falls back to a background request that also outlives the page. The body goes as plain text, so no CORS preflight is needed.

When a shopper objects

Once the shopper has objected to measurement, the command sends nothing, whether the objection was stored on an earlier page, made in the panel, or set by a privacy call. A privacy objection queued on the same page before the tag loaded stops a queued transaction too, whatever their order.

The order is then not recorded at all. That is intended: a shopper who objected is not measured.

Check that it worked

  1. Open your confirmation page with your browser's developer tools on the Network tab, and place a test order.
  2. Look for a request to /api/public/sites/pk_site_…/orders. It answers 204 whatever happens, so the request only proves the tag sent it.
  3. Look at the Console for a [iadvize] transaction ignored warning.
  4. Check that the agent kept it: lastStorefrontOrderAt in Get a site's storefront activity or get_storefront_activity shows the time of the latest order received, and your site's revenue on the Orders page of the Sales report includes it.

To check the link to a conversation, send a message to the agent on your site first, then place the order in the same browser. The order shows in that conversation's Sale attribution.

A test order counts like a real one, and there is no way to delete it. Use a low amount, or test on a site you keep for testing.

Limits

  • The order goes only if the tag runs on the confirmation page. A script blocker, a consent tool that holds the tag, or a confirmation page that does not load the snippet means the order is not reported at all, not even for your site's total. For orders that must all be counted, send them from your server instead.
  • The key stays in the browser the shopper chatted in. An order on another device or browser, or confirmed on a domain other than your site's, carries no key. See Orders that stay unlinked.
  • It runs in the shopper's browser, so it can be forged. Anyone can call it, or post to the endpoint, with your public site key. A forged order changes only your own figures.
  • No refunds, cancellations or order lines. See Limits.