Troubleshooting revenue
The Revenue screen still shows the setup card
Section titled “The Revenue screen still shows the setup card”The screen switches on as soon as one event with an amount exists for the site. If it still shows the “Track revenue” card, no such event has been written.
- Open Realtime and complete a test purchase. If nothing appears in the
live feed at all, the script is not running on that page: check the
data-sitekey and that the tag is in the HTML of the page that completes the purchase, not only the storefront. - If the event appears but is not a revenue event, look at what you sent.
revenuemust be a number:{ revenue: "49" }is a string and is stored as an ordinary property.tracing.revenue("49")is likewise not a number. - If the purchase completes on another domain (a hosted checkout, a payment page), the script has to be installed there too, with the same site key.
- If the call runs before the script has loaded and there is no
queue stub, the
browser throws a
ReferenceErrorand nothing is sent. Add the stub, or guard withwindow.tracing?.(...).
Nothing arrives from some visitors
Section titled “Nothing arrives from some visitors”The tracker is a script, and scripts get blocked. A content blocker that stops the tracker stops its revenue events with it, so the Revenue screen undercounts by whatever share of your buyers block it. Serving the script from your own domain helps; see Proxying.
The amount is a hundred times too big or too small
Section titled “The amount is a hundred times too big or too small”Send major units: 49 for forty-nine dollars. The tracker converts to
minor units itself.
| You sent | Stored as | Shown as |
|---|---|---|
revenue: 49 |
4900 |
$49.00 |
revenue: 4900 |
490000 |
$4,900.00 |
revenue: 0.49 |
49 |
$0.49 |
Zero-decimal currencies are the exception in the other direction:
revenue: 1200, currency: "JPY" is stored as 1200 and shown as ¥1,200. See
Amounts.
The currency is wrong or missing
Section titled “The currency is wrong or missing”currency defaults to USD when omitted, so an event sent without one lands
in the dollar report even if your store sells in euros. Pass the currency the
customer paid in on every call, or set the site currency in
Settings and pass that.
Codes are ISO 4217. A typo like EURO or US$ is stored as its own currency
and shows up as a separate entry in the switcher.
Two currencies do not add up
Section titled “Two currencies do not add up”They are not supposed to. Adding a yen to a dollar produces a number that is true in no currency, so every figure on the Revenue screen is partitioned by currency and the screen reports one at a time.
The switcher appears when more than one currency took money in the range. A visit’s own revenue figure on the Sessions list adds only the amounts reported in the site currency, because a session rollup holds one number.
A revenue event counted twice
Section titled “A revenue event counted twice”The tracker sends exactly what your code calls. Two rows with the same amount a second apart usually mean the purchase page fired twice: a reload of the thank-you page, a single-page app re-running an effect, or a listener bound twice. Fire the event once, from the code path that runs once, and keep a guard if the page can be revisited:
if (!sessionStorage.getItem("order_" + orderId)) { tracing("purchase", { revenue: total, currency, orderId }); sessionStorage.setItem("order_" + orderId, "1");}Revenue shows on Sessions but not on a filtered Revenue screen
Section titled “Revenue shows on Sessions but not on a filtered Revenue screen”A filter describes visits, so a filtered Revenue screen keeps the revenue events whose visit matches. Check the filter you have on, and the currency: an event in a currency other than the one selected is not in the report you are looking at.