Revenue and CRM tables
Revenue tables drive lifetime value, MRR, ARR and churn. CRM tables drive lead and pipeline attribution.
Revenue
Roadway uses revenue data for lifetime value, MRR, ARR and churn by channel and campaign.
Pick a model first. See Choose a revenue model.
Recurring revenue
Option 1: Airbyte Stripe connector
Sync these tables with the Airbyte Stripe source connector. Use sync mode Incremental (Append or Append + Deduped). Roadway deduplicates. Use the table prefix stripe_.
| Table | Required |
|---|---|
stripe_customers, stripe_subscriptions, stripe_subscription_items, stripe_charges, stripe_invoices, stripe_invoice_line_items, stripe_products, stripe_prices, stripe_plans, stripe_balance_transactions, stripe_coupons, stripe_events |
Yes |
stripe_checkout_sessions |
Yes, if you bill with Payment Links |
stripe_payment_intents, stripe_refunds |
Optional |
Step-by-step: Stripe through Airbyte.
Option 2: custom revenue models
Provide dim__customers and fact__customer_arr_snapshot. Use this option if you already define revenue metrics yourself.
dim__customers (custom models)
| Column | Type | Description | Required |
|---|---|---|---|
customer_id |
varchar | Unique customer ID. Primary key | Yes |
user_id |
varchar | Internal user ID. Must match Users. Not null | Yes |
first_payment_date |
date | Date of the first successful payment | Yes |
created_date |
date | Account creation date | Yes |
currency |
varchar | Primary currency (ISO 4217, three characters) | Yes |
<custom dimensions> |
varchar | Segmentation fields | No |
CREATE TABLE dim__customers (
customer_id VARCHAR(255) PRIMARY KEY,
user_id VARCHAR(255) NOT NULL,
first_payment_date DATE NOT NULL,
created_date DATE NOT NULL,
currency VARCHAR(3) NOT NULL,
custom_dimension_1 VARCHAR(255),
custom_dimension_2 VARCHAR(255),
custom_dimension_3 VARCHAR(255)
);
fact__customer_arr_snapshot
A daily snapshot of ARR and subscription state, one row per customer, subscription, and day.
| Column | Type | Description | Required |
|---|---|---|---|
customer_id |
varchar | Customer ID | Yes |
subscription_id |
varchar | Subscription ID | Yes |
date_day |
date | Snapshot date | Yes |
implied_arr |
float | Annualized revenue implied by the current subscription | Yes |
paid_arr |
float | ARR based on payments actually received | Yes |
new_arr |
float | New ARR from new subscriptions on this day | Yes |
churn_arr |
float | ARR lost from cancellations, as a negative number | Yes |
expansion_arr |
float | ARR gained from upgrades | Yes |
contraction_arr |
float | ARR lost from downgrades, as a negative number | Yes |
reactivation_arr |
float | ARR gained from reactivated subscriptions | Yes |
num_seats |
integer | Seats or licenses | Recommended |
plan_type |
varchar | Plan identifier | Yes |
billing_period |
varchar | Billing frequency, such as monthly or annual | Yes |
subscription_status |
varchar | Current status | Yes |
Primary key: (customer_id, subscription_id, date_day).
CREATE TABLE fact__customer_arr_snapshot (
customer_id VARCHAR(255) NOT NULL,
subscription_id VARCHAR(255) NOT NULL,
date_day DATE NOT NULL,
implied_arr FLOAT NOT NULL,
paid_arr FLOAT NOT NULL,
new_arr FLOAT NOT NULL,
churn_arr FLOAT NOT NULL,
expansion_arr FLOAT NOT NULL,
contraction_arr FLOAT NOT NULL,
reactivation_arr FLOAT NOT NULL,
num_seats INTEGER,
plan_type VARCHAR(255) NOT NULL,
billing_period VARCHAR(50) NOT NULL,
subscription_status VARCHAR(50) NOT NULL,
PRIMARY KEY (customer_id, subscription_id, date_day),
FOREIGN KEY (customer_id) REFERENCES dim__customers(customer_id)
);
Constraints:
- Continuous daily records from the first payment date to today (or the churn date)
churn_arrandcontraction_arrare zero or negative; the other ARR columns are zero or positive- Separate rows per subscription for customers with several subscriptions
- Data refreshed regularly
Validate custom revenue tables
| Rule | Meaning |
|---|---|
Unique customer_id in dim__customers |
One row per customer |
Non-null customer_id and user_id in dim__customers |
Every customer links to a user |
Non-null customer_id, subscription_id, date_day in the snapshot |
|
| Valid dates and ISO currency codes | |
| Continuous date series | No missing days |
Consistent customer_id across tables |
Transactional revenue
Use for individual purchases, such as orders and one-off payments. Roadway builds revenue, transaction, and average-order-value metrics from this table. It doesn't compute ARR or churn from transactions.
Talk to Roadway before you build these tables.
fact__transactions
| Column | Type | Description | Required |
|---|---|---|---|
transaction_id |
varchar | Unique transaction ID. Primary key | Yes |
transacted_at |
timestamp | UTC time of the transaction | Yes |
user_id |
varchar | The paying user. Must match user_id in Users |
Yes |
revenue |
decimal | Amount in your reporting currency. Negative for refunds and chargebacks | Yes |
customer_id |
varchar | The paying billing account. Joins dim__customers. If the user pays directly, set it to the user_id. Not null |
Yes |
<custom dimensions> |
varchar | Product, SKU, transaction type, and so on | No |
CREATE TABLE fact__transactions (
transaction_id VARCHAR(255) PRIMARY KEY,
transacted_at TIMESTAMP NOT NULL,
user_id VARCHAR(255) NOT NULL,
revenue DECIMAL(18,2) NOT NULL,
customer_id VARCHAR(255) NOT NULL,
custom_dimension_1 VARCHAR(255),
custom_dimension_2 VARCHAR(255)
);
Constraints:
transaction_idis unique.customer_idis not null on every row.user_idjoins each transaction to its attribution. Transactions whoseuser_idhas no match in Users are reported under No tracked visit.revenueis in currency units (not cents or micros) and one reporting currency.- Add refunds and chargebacks as separate negative rows.
- Rows with
revenue = 0are ignored.
dim__customers (optional for transactional revenue)
If you don't provide it, Roadway creates one customer per customer_id, using the first transaction as first_payment_date. Provide it when several users pay into one account, or to segment customers.
| Column | Type | Description | Required |
|---|---|---|---|
customer_id |
varchar | Unique customer ID. Primary key | Yes |
user_id |
varchar | The user who created the customer. Must match Users. Not null | Yes |
first_payment_date |
date | Date of the first transaction | Yes |
created_date |
date | Account creation date | No |
currency |
varchar | Primary currency | No |
<custom dimensions> |
varchar | Segmentation fields | No |
CRM
To track prospects through your sales funnel, Roadway needs tables for contacts or leads, opportunities or deals, and pipeline ARR.
See Set up your CRM for the model.
These schemas apply when you build the tables. With a direct connector, Roadway builds them.
dim__contacts
Tracks each lead or contact as it moves through lifecycle stages.
| Column | Type | Description |
|---|---|---|
contact_id |
varchar | Contact or lead ID from Salesforce or HubSpot. Primary key |
visitor_id |
varchar, nullable | The anonymous visitor ID captured on the form that created the contact. See Capture IDs in forms |
created_date |
date | UTC date the contact was created |
<lifecycle_stage>_reached_date |
date | UTC date the contact reached each lifecycle stage. One column per stage |
<custom dimensions> |
See Custom dimensions | Segmentation fields such as pipeline name, opportunity type, or country |
Where possible Roadway joins visitor_id to page views for attribution.
dim__opportunities (dim__deals)
Tracks each opportunity (Salesforce) or deal (HubSpot).
| Column | Type | Description |
|---|---|---|
opportunity_id (deal_id) |
varchar | Unique ID. Primary key |
contact_id |
varchar | The owning (or oldest) contact. Drives attribution for the opportunity |
created_date |
date | UTC creation date |
<opportunity_stage>_reached_date |
date | UTC date the opportunity reached each stage. One column per stage |
closed_date |
date, nullable | UTC close date, null if open |
is_closed_won |
boolean | Whether it closed and converted to a customer |
<custom dimensions> |
See Custom dimensions | Segmentation fields |
fact__pipeline_arr_snapshot
Tracks pipeline ARR attributed to sales processes, similar to fact__customer_arr_snapshot.
| Column | Type | Description |
|---|---|---|
opportunity_id (deal_id) |
varchar | The opportunity or deal ID |
date_day |
date | An as-of date |
pipeline_arr |
float | Annualized value implied by the opportunity, multiplied by the probability of closing, for that day |
Primary key: (opportunity_id, date_day). From the opportunity's creation date to its close date (inclusive), there must be one row per day.
DDL example
CREATE TABLE dim__contacts (
contact_id VARCHAR(255) PRIMARY KEY,
visitor_id VARCHAR(255),
created_date DATE NOT NULL,
lead_reached_date DATE,
mql_reached_date DATE,
sql_reached_date DATE
);
CREATE TABLE dim__opportunities (
opportunity_id VARCHAR(255) PRIMARY KEY,
contact_id VARCHAR(255) NOT NULL,
created_date DATE NOT NULL,
closed_date DATE,
is_closed_won BOOLEAN NOT NULL
);
CREATE TABLE fact__pipeline_arr_snapshot (
opportunity_id VARCHAR(255) NOT NULL,
date_day DATE NOT NULL,
pipeline_arr FLOAT NOT NULL,
PRIMARY KEY (opportunity_id, date_day)
);
The stage-date columns are examples. Name yours after your stages. See Lifecycle stages and pipelines.
Validation
contact_idandopportunity_idare unique.- Every
dim__opportunities.contact_idexists indim__contacts. visitor_idcoverage matches the share of contacts created through tagged forms.- Pipeline snapshot has no missing days for open and closed opportunities.