ENES Start free trial

Track revenue: send the purchase amount without personal data

Visits tell you where people come from. Revenue tells you which of those visits are worth money. FastAnalytics only needs one number per purchase: the amount.

FastAnalytics team · Updated · 4 min read

From your code

Call hm() when the payment is confirmed, usually on the thank-you page. The first value is the event name and revenue is the amount, with a dot or a comma for decimals.

hm('purchase', { revenue: 49.90 });

Important: the install code loads the script with defer, so it runs when the page has finished loading. If your hm() call comes earlier (for example inline in the thank-you page), add this one-line queue before it, or use the install code from your dashboard, which already includes it. Calls are kept and sent as soon as the script loads, so no sale is lost:

<script>window.hm=window.hm||function(){(window.hm.q=window.hm.q||[]).push(arguments)};</script>
<script>hm('purchase', { revenue: 49.90, order: 'A1234' });</script>

Do not count a sale twice

Thank-you pages can be reloaded or opened again from the browser history, and each time would count another sale. Send the order number in order (or data-hm-order on the button) and FastAnalytics counts each order only once per website for 30 days. Without order, send the event only the first time the page loads (for example, mark it on your server when the payment is confirmed).

Easiest: a tag on the thank-you page

No JavaScript needed and it works wherever you place it on the page, even with defer. Fill in the amount and, if you can, the order number. The amount can be written as your shop prints it: 49.90, 49,90 € or €1,234.56.

<div data-hm-purchase="49.90" data-hm-order="A1234" hidden></div>

The script sends it once when the page loads. With data-hm-order a reload does not count the sale again. Add data-hm-name="subscription" if you want another event name.

Without code

Add data-hm and data-hm-revenue to the button or link that confirms the purchase.

<button data-hm="purchase" data-hm-revenue="49.90" data-hm-order="A1234">Pay</button>

Does the purchase finish on another domain?

If people land on one domain and pay on another one (your shop, a checkout or your app), add the payment domain to your website's domains in My websites › Manage and send the campaign with the purchase:

hm('purchase', { revenue: 49.90, order: 'A1234', utm_source: 'meta', utm_medium: 'paid_social', utm_campaign: 'summer' });

Step by step, with the tag version and how to test it: Track sales and UTM campaigns when checkout is on another domain.

What is stored (and what is not)

  • Only the amount, as a whole number of cents, is stored with the event.
  • The order number in order is never stored. Our server keeps only an encrypted fingerprint of it (it cannot be turned back into the number) for 30 days, just to spot repeats, and then deletes it.
  • Never send order numbers in the event name, nor emails, names or addresses. The script and our server also clean them: emails become :email and long numbers (phones, order or card numbers) become #.
  • Amounts are shown in euros. If your shop uses another currency, the figures are still correct but the € sign will not match.

Where you see it

In the dashboard, Marketing → Revenue shows revenue, orders, buyers, average order and conversion, with the previous period, a daily chart and tables by channel, source, UTM campaign, entry page and event. You can also add Revenue cards to My dashboard.

Each purchase is attributed to how that visitor arrived the same day. The visitor identifier changes every day, so a purchase made days after the first visit is attributed to the visit on the day of purchase.

FAQ

Can I send the order ID to avoid duplicates?

Yes, in order (or data-hm-order). We never store it: we keep only an encrypted fingerprint for 30 days so the same order is not counted twice.

Does it work with WooCommerce or Shopify?

Yes, on any site where you can add a line of JavaScript to the order confirmation page.

Keep reading