What this dataset is
Order data has a shape that single-table campaign data does not: a customer has many orders, an order has many items, and most interesting questions need all three levels joined without counting anything twice. This dataset is that shape at a small scale, for an invented online retailer selling a few dozen products across a handful of categories over one year. Customers arrive through the same channels the sample campaign dataset uses, so that spend from one can be matched to new customers in the other for an acquisition cost exercise.
Because the data is generated, every relationship in it is documented. The practice datasets hub sets out the labelling: the tables are modelled, the sample rows on this page are illustrative, and nothing here is evidence about how real customers behave. The metrics the dataset is built to teach are average order value (AOVAverage revenue per order.), customer lifetime value (LTVTotal value a customer brings over time.) over a defined horizon, customer acquisition cost (CACCost to acquire one new customer.) when joined to spend, and the purchase conversion rate (CVRShare of visits or clicks that convert.) from visitors where a sessions table is added; the customer analytics overview explains how those measures fit together in a real business.
Schema
Three tables, related by keys. Column names are lower case with underscores; dates are ISO dates; money is in a single currency with two decimal places.
Customers
| Column | Type | Description | Notes |
|---|---|---|---|
customer_id | Text | Stable identifier | Primary key; one row per customer |
first_order_date | Date | Date of the customer's first completed order | Defines the acquisition cohort |
acquisition_channel | Text | Channel of the first order's session | Matches the campaign dataset's channel values plus organic_search, email and direct |
region | Text | Broad delivery region | A few values; used for segmentation exercises |
marketing_consent | Boolean | Whether the customer accepted marketing email | Planted pattern: consented customers repeat more often |
Orders
| Column | Type | Description | Notes |
|---|---|---|---|
order_id | Text | Stable identifier | Primary key; one row per order |
customer_id | Text | The ordering customer | Foreign key to customers |
order_date | Date | Date the order was placed | Never earlier than the customer's first order date |
order_total | Decimal | Goods value after discount, before shipping | Equals the sum of the order's item lines; a few rows are planted not to |
discount_code | Text | The code applied, if any | Empty for most orders |
status | Text | Completed, cancelled or returned | Cancelled and returned orders are present on purpose |
Items
| Column | Type | Description | Notes |
|---|---|---|---|
order_id | Text | The parent order | Foreign key to orders; several rows per order |
product_id | Text | Stable product identifier | A few dozen products |
category | Text | Product category | A handful of values |
quantity | Integer | Units of the product on this order | Usually one |
unit_price | Decimal | Price per unit at the time of the order | Varies by product; stable within the year |
line_total | Decimal | Quantity multiplied by unit price, less line discount | Sums to the order total except where planted |
How it was generated
The generator creates customers first, drawing an acquisition date across the year with a planted seasonal peak late in the year, and assigns each a channel according to a fixed channel mix. It then simulates each customer's later orders: after the first order, each month the customer either orders again or does not, with a base repeat probability that decays over time and that differs by acquisition channel and by marketing consent. Each order draws a number of items and the items draw products from a category mix, with unit prices fixed per product and a discount applied to a minority of orders. A small share of orders are marked cancelled or returned after the fact. The seed is fixed, so the files reproduce exactly.
The planted patterns are the exercises' answer key. Customers acquired through email and organic search repeat more often than those acquired through paid social, and consented customers repeat more than non-consented ones in every channel. Average order value is higher for customers whose first order contained an item from the largest category. A promotional discount code planted in one month raises order counts for that month and lowers average order value, and the customers it acquired repeat less than the rest. Three data-quality faults are planted: a few orders whose total does not equal the sum of their lines, a handful of exact duplicate item rows, and some customers whose first order date is later than their earliest order, imitating a backfilled customer record.
Sample rows
The rows below show one customer, two of her orders and the items on the first. They are illustrative and generated; nothing about them describes a real buyer.
One customer across the three tables
Customers:
| customer_id | first_order_date | acquisition_channel | region | marketing_consent |
|---|---|---|---|---|
| c_004182 | 2026-03-07 | north | true |
Orders:
| order_id | customer_id | order_date | order_total | discount_code | status |
|---|---|---|---|---|---|
| o_011907 | c_004182 | 2026-03-07 | 68.50 | completed | |
| o_013644 | c_004182 | 2026-05-19 | 41.00 | SPRING10 | completed |
Items for the first order:
| order_id | product_id | category | quantity | unit_price | line_total |
|---|---|---|---|---|---|
| o_011907 | p_031 | kitchen | 1 | 44.50 | 44.50 |
| o_011907 | p_118 | textiles | 2 | 12.00 | 24.00 |
The customer belongs to the March cohort for email, which is one of the planted high-retention groups: in the generated file, 31 percent of that cohort order again in their third month after acquisition, against 18 percent of the March paid social cohort. Across all completed orders the file holds 2,640 orders from 1,910 customers with an average order value of £57.20, figures that exist so that an exercise can be checked, not so that they can be quoted.
Exercises: cohorts, AOV, repeat rate
Work through the exercises in order; each depends on a join the previous one proved correct. Begin with row counts: count customers, orders and items separately, then join orders to customers and confirm the order count is unchanged, then join items to orders and confirm the item count is unchanged. Any multiplication is fan-out, and the habit of checking counts at each step is the single most valuable thing the dataset teaches. Next, compute average order value by acquisition channel over completed orders only, excluding cancelled and returned rows, and then recompute it including them to see how much the status filter matters; the average order value levers guide explains why a business would then look at the category and discount patterns behind the differences. A query for the first step, without literal numbers, is:
SELECT c.acquisition_channel,
COUNT(DISTINCT o.order_id) AS orders,
SUM(o.order_total) / COUNT(DISTINCT o.order_id) AS average_order_value
FROM orders AS o
JOIN customers AS c ON c.customer_id = o.customer_id
WHERE o.status = 'completed'
GROUP BY c.acquisition_channel
ORDER BY average_order_value DESC;
Then build the cohort table: group customers by the month of their first order, and for each later month compute the share of the cohort that placed an order. Lay it out as a triangle with cohorts as rows and months since acquisition as columns, which is the layout the cohort analysis guide teaches, and split it by acquisition channel to find the planted retention differences. Compute repeat purchase rate as the share of customers with more than one completed order within a fixed window, and notice how the window length changes the figure. Then find the planted faults: orders whose total differs from their line sum, duplicate item rows, and customers whose first order date is after their earliest order; decide for each whether to repair, exclude or flag. Finally, join to the campaign dataset's spend by channel to compute a cost per new customer, and compare it with the margin the cohort table implies over a twelve-month horizon, which is the shape of a lifetime value to acquisition cost comparison.
Limits of synthetic data
The generator knows nothing about products beyond a price and a category, so there is no seasonality by product, no stock-outs, no price changes within the year and no cross-sell structure beyond the category mix. Repeat behaviour follows a decaying probability with channel and consent effects, which is a caricature of real retention: real customers lapse and return, respond to specific campaigns, and differ far more within a channel than between channels. There is no sessions table, so conversion rate from visits cannot be computed without adding one. Returns and cancellations are random rather than tied to product or discount. And the three planted faults are the only faults; a real order export of similar size would carry test orders, currency inconsistencies, merged customer records and more. The dataset therefore teaches the mechanics of joins, cohorts and order-level metrics, and it should not be used to form intuitions about what retention or order value a real retailer should expect.
Common mistakes
- Joining items before aggregating orders. The order count multiplies by the items per order; aggregate orders first or count distinct order ids.
- Cohorts by order month. A cohort is defined by the customer's first order; grouping by the month of each order produces a table that looks right and means nothing.
- Including cancelled orders in revenue. The status column exists so the filter is practised; state in every result which statuses were included.
- Quoting the retention or order value figures. They are properties of the generator's base rates and planted patterns, not of any market.
- Trusting the order total. A few rows are planted to disagree with their line sums; reconcile before reporting either.
- A repeat rate without a window. The figure depends entirely on how long customers have had to come back; always state the window and compare cohorts of the same age.
