Metric definitions
How every number on this dashboard is calculated, and where it comes from. This is the single
source of truth — the SQL that produces these lives in transforms/*.sql.
| Metric | Definition | Source |
| Gross sales | Sum of order subtotals (after line discounts, before tax & shipping) | Shopify subtotal_price |
| Refunds | Refunded product value (line-item subtotals returned) | Shopify, nested in each order |
| Net revenue | Gross sales − refunds. The 100% base for all margin %s. | derived |
| AOV (avg order value) | Net revenue ÷ orders | derived |
| Units sold | Sum of line-item quantities | Shopify order line items |
| Metric | Definition | Source |
| Product COGS | Σ(qty × unit cost), using the cost that was valid on the order date (effective-dated) | Shopify cost-per-item (read_inventory) |
| Processing fees | Actual payment fees taken per order | Shopify Payments balance transactions |
| Shipping | Actual carrier/label cost (postage), summed per order | ShipStation "Carrier Fee" export |
| Packaging | Flat box/mailer cost per order ($1) | constant (move to Sheet later) |
| Ad spend | Facebook ad spend | Facebook Marketing API |
| Metric | Definition |
| Gross profit | Net revenue − product COGS |
| Gross margin % | Gross profit ÷ net revenue |
| Profit before ads (contribution) | Net revenue − COGS − fees − shipping − packaging. Your budget to acquire a customer. |
| Net profit | Net revenue − COGS − fees − shipping − packaging − ad spend. The real bottom line. |
| Net margin % | Net profit ÷ net revenue |
| Net profit / order | Net profit ÷ orders |
A customer is New on the order where their account was created (their first order); every
later purchase is Returning. Three lenses, three denominators — they differ on purpose:
| Metric | Definition | Note |
| New customers | Distinct customers acquired (first order) in the period | |
| Returning customer rate | Returning customers ÷ all customers | = Shopify's "returning customer rate" (counts people) |
| Returning order rate | Returning orders ÷ all orders | repeats order more often |
| Returning revenue rate | Returning revenue ÷ all revenue | repeats also spend more per order |
| Metric | Definition | Note |
| New-customer CAC (real) | Ad spend ÷ new Shopify customers | The honest acquisition cost. Repeat buyers excluded. |
| Ad cost / order (blended) | Ad spend ÷ all orders | Lower than true CAC (repeats included); an efficiency gauge. |
| CAC (FB) | Ad spend ÷ FB-attributed conversions, per ad | FB's own attribution — over-credits paid & includes repeats. Use to rank ads vs each other, not as true CAC. |
| FB ROAS | FB-attributed conversion value ÷ ad spend | FB's number; inflated vs true profit. |
| CTR | Clicks ÷ impressions | |
| CPM | Ad spend ÷ impressions × 1,000 | |
| MER | Net revenue ÷ ad spend | Blended; we de-emphasize it (counts organic + repeat sales). |
The home page is the truth: real costs, CAC on new customers only, contribution vs CAC.
The Marketing page shows Facebook's own numbers (ROAS, FB CAC) — great for comparing ads
to each other, but FB over-attributes, so never read its ROAS as your real profit.
Timezone: every "day" is bucketed to America/Los_Angeles (your store + ad account
timezone), so order-days and ad-days line up. Costs are effective-dated, so changing a cost
today never rewrites last month's profit.