How to calculate Revenue per Visitor

Revenue per visitor is the average revenue each store visitor generates, whether or not they buy.

Formula

Revenue per visitor = total revenue ÷ unique visitors

SQL query

This example assumes: sessions(id, visitor_id, started_at), orders(id, visitor_id, total, status). It is written in PostgreSQL syntax; date functions differ slightly in MySQL, BigQuery and SQLite, and your column names will differ from these.

WITH v AS (
  SELECT COUNT(DISTINCT visitor_id) AS visitors FROM sessions
  WHERE started_at >= CURRENT_DATE - 30
), r AS (
  SELECT COALESCE(SUM(total), 0) AS revenue FROM orders
  WHERE status = 'paid' AND ordered_at >= CURRENT_DATE - 30
)
SELECT r.revenue / NULLIF(v.visitors, 0) AS revenue_per_visitor
FROM r, v;

Common mistakes that make Revenue per Visitor wrong

  • Visitor and revenue windows must match exactly.
  • Bot traffic inflates the visitor count and so lowers the figure.
  • It combines conversion rate and AOV; look at both to see which moved.

Ask for Revenue per Visitor in plain English

Instead of writing the query yourself, you can type the question. SchemaChat turns it into SQL against your connected database or uploaded file, runs it, and shows the SQL and the figures it used so you can check the answer before you share it. It does not replace your judgement about the definition: check that the query matches the formula your business uses.

  • What is our revenue per visitor this month?
  • Which traffic sources produce the most revenue per visitor?

Frequently asked questions

What is Revenue per Visitor?
Revenue per visitor is the average revenue each store visitor generates, whether or not they buy.
How do you calculate Revenue per Visitor?
Revenue per visitor = total revenue ÷ unique visitors. The SQL example on this page shows the same calculation against a simple table.
What commonly goes wrong when calculating Revenue per Visitor?
Visitor and revenue windows must match exactly.