Last updated 26 November 2026. By Paul Badarau.
A fictional print shop sells posters for 18 to 60 dollars. Buyers pay on the payment provider's page, which sends them back to /order/complete on the shop's own domain. That return page is the only place the shop can run code after a sale, so the revenue call goes there.
- In Analytics, add a goal with the matching rule Named event and the name
purchase. Owners and Administrators can add goals. The goal has to exist before the first sale is sent, because the collector refuses event names that are not goals of the Project. - On the confirmation page, have your server print the order total into one call:
document.addEventListener("DOMContentLoaded", function () { if (window.postdeploy) postdeploy.track("purchase", { revenue: 42.00 }); });The tracking snippet loads withdefer, and the browser fires DOMContentLoaded only after deferred scripts have run, sopostdeployexists by then. The value must be a number from 0 to 1,000,000, and Analytics rounds it to two decimals. - Print the call only on the first view of each order. A buyer who reloads the page or opens it again from the receipt email would otherwise run it twice, and the sale would count twice.
- Place a small test order on the live site. It stays in the reports like any other sale. Open the Project report for Today and check the goal's completion and revenue.
In PostDeploy Analytics, revenue sits beside visitors, pageviews and conversions in the Project reports, and each breakdown has it: source, referrer, campaign, country, device, browser, page and entry page. A sale counts under the source of the visit it happened in. You can see whether the newsletter or a forum post brings people who buy.
If the shop sells in more than one currency, convert each total to one currency before sending it, because Analytics stores only the number.
The revenue in Analytics will not match your payment records. It is the sum of what buyers' browsers sent from the confirmation page. Refunds are missing, because a value cannot be negative. A sale is missing when the buyer closes the tab before returning to your site, when a blocker stopped the script, or when the browser sends Do Not Track or Global Privacy Control, which new Projects respect by default. Keep the books with your payment provider, and use Analytics to see which sources and pages lead to sales.
Without cookies, a sale belongs to the day it happened. Someone who finds the shop through a newsletter on Monday and comes back through a bookmark on Thursday counts as two visitor-days, and the sale goes to Direct, the source of Thursday's visit.
The product page for this is Analytics.