E-commerce revenue dashboard showing top products and average order value in statpx

How to Track E-commerce in statpx: Purchases, Revenue, and Top Products

The E-commerce module in statpx follows a shopper from the moment they view a product to the moment they pay, then rolls every purchase up into a revenue dashboard, a top-products list, and an average order value figure. None of it requires a separate integration — four _st('ecommerce', ...) calls placed at the right points in your storefront are enough. This guide covers each call and how to read the numbers on the E-commerce page.

The Four E-commerce Events

statpx recognizes four e-commerce event types, matching the natural shape of a shopping flow: view (a product page load), add_cart (added to cart), begin_checkout (checkout started), and purchase (order completed). Fire each one at the moment it actually happens in your storefront's flow — the dashboard uses the sequence to compute drop-off between stages as well as final revenue.

Firing the Calls

On a product page:

_st('ecommerce', 'view', { product_id: 'SKU-123', product_name: 'Pro Plan', category: 'Subscription', price: 49.99, currency: 'USD' });

When a shopper adds an item to their cart:

_st('ecommerce', 'add_cart', { product_id: 'SKU-123', price: 49.99, quantity: 1 });

When checkout starts:

_st('ecommerce', 'begin_checkout', { total: 49.99 });

And on the order confirmation page, once the order is actually placed:

_st('ecommerce', 'purchase', { order_id: 'ORD-456', total: 49.99, currency: 'USD', product_id: 'SKU-123', product_name: 'Pro Plan' });

Only fire purchase once per completed order — guard against duplicate fires on page refresh with a flag or by keying off the confirmation page load, not a button click.

You don't have to fire every event for every product page — a storefront with dozens of SKUs can wire view and add_cart into a shared product template once, passing the specific product_id, product_name, and price from your existing page data, so new products get tracked automatically without touching the tracking code again.

The Revenue Dashboard, Top Products, and AOV

Once purchase events start arriving, the E-commerce page shows total revenue for the selected date range, a trend over time, and a ranked list of top products by revenue and by units sold — built entirely from the product_id/product_name fields you pass in. It also computes average order value (AOV): total revenue divided by number of orders, which is the number to watch when you're testing upsells, bundling, or free-shipping thresholds, since it can move independently of raw order count.

Currency matters for aggregation. Pass a consistent currency code (e.g. USD) on every purchase for a site — mixed currencies without conversion will distort revenue totals and AOV.

Because view → add_cart → begin_checkout → purchase mirrors a funnel, you can also build an explicit funnel using these same event names as steps to see exactly where shoppers abandon before paying. For the underlying math behind conversion rate and revenue metrics, see our e-commerce analytics guide.

See your store's revenue and top products free

statpx turns four simple tracking calls into a full revenue dashboard — top products, AOV, and purchase trends, no separate e-commerce platform integration required.

Start for free →

The Bottom Line

E-commerce tracking in statpx is four calls mapped to four real moments in a purchase: viewing, adding to cart, starting checkout, and paying. Get those four calls right — consistent product IDs, a single currency, one purchase fire per order — and the dashboard does the rest: revenue over time, which products actually sell, and whether your average order value is moving in the right direction.

Continue reading

Technical
How to Identify and Block Referrer Spam in Website Analytics
Metrics
How to Track and Reduce Shopping Cart Abandonment with Analytics
Privacy
Google Consent Mode v2 Explained: What It Means for Your Analytics
Analytics by statpx