E-Commerce Data Model

Overview

An online retail business modeled end to end — from the traffic that arrives on the storefront, through browsing sessions and product discovery, to orders, revenue and repeat purchasing, with paid advertising across every major channel tied back to the sales it drives. Web sessions, pageviews and traffic sources describe how shoppers find and move through the store; the product catalog and its categories describe what they browse; orders, purchases and customers capture what they buy and how often they return; and unified ad spend brings Google, Facebook, TikTok, LinkedIn, Microsoft, Reddit and X advertising together with Shopify sales so acquisition cost can be weighed against the revenue it returns.

Example Questions

  • Which traffic sources and paid channels bring in the shoppers who actually convert, and what does each acquired customer cost versus the revenue they generate?
  • How does the storefront funnel — sessions to product views to orders — convert, and where are the biggest drop-offs by country, category or landing page?
  • Which products and categories drive the most revenue and repeat purchasing, and how does that shift across countries and over time?

Explore on canvas →

Countries Data Mart

Countries

The countries the storefront sells into, and the relative weight each one carries in the business. Every visitor, session and customer is tied to a country here, which makes this the single place geography is defined for the whole model — so revenue, conversion and acquisition cost can all be cut the same way across markets.

Fields

ColumnTypeAliasDescription
country_idINTEGERCountry IDPK. Unique internal identifier for each country record.
countrySTRINGCountry NameFull name of the country.
country_codeSTRINGCountry CodeTwo-letter ISO country code representing the nation.
weightINTEGERPriority WeightNumerical value used to prioritize or rank countries in the e-commerce system.

Customers Data Mart

Customers

Everyone who has registered an account on the storefront, with the channel that first brought them in, the market they belong to, and the segment their buying behaviour puts them in. This is where acquisition meets retention: the same row explains how a customer was won and how valuable they turned out to be.

Fields

ColumnTypeAliasDescription
customer_idINTEGERCustomer IDPK. Unique identifier for an individual registered customer
customer_segmentSTRINGCustomer SegmentThe classification of the customer based on their purchase history or value
registration_dateDATERegistration DateThe specific date when the customer account was created in the system
acquisition_traffic_source_idINTEGERFK to Traffic Sources
country_idINTEGERCountry IDThe primary geographical location assigned to the customer FK to Countries

Relationships

Related data martOnCardinalityMeaning
Countriescountry_id = country_idN:1The customer's home market.
Acquisition Traffic Sourceacquisition_traffic_source_id = traffic_source_idN:1The channel that acquired this customer.

Orders Data Mart

Orders

One row per order placed on the storefront — the header of the transaction, tying the browsing session it came from to the customer who placed it, the date, and the fulfilment state. Because a cancelled or returned order still occupies a row, gross order counts and settled revenue can be told apart instead of quietly merged.

Fields

ColumnTypeAliasDescription
session_idSTRINGSession IDUnique identifier of the session where the order was placed FK to Sessions
customer_idINTEGERCustomer IDUnique identifier of the customer who placed the order FK to Customers
order_dateDATEOrder DateThe date when the transaction was completed
order_idSTRINGOrder IDPK. Unique identifier of the purchase transaction FK to Purchases
statusSTRINGStatusCurrent fulfillment state of the order (e.g., Completed)
orders_totalINTEGEROrdersDistinct orders in the selected rows, every status.
completed_ordersINTEGERCompleted OrdersOrders that completed — a conditional count with no helper column.
completion_rateFLOATCompletion RateShare of orders that completed rather than being cancelled or returned.
distinct_products_in_orderINTEGERDistinct Products in OrderDistinct products across the selected orders' lines, counted through Purchases into Products.

Relationships

Related data martOnCardinalityMeaning
Customerscustomer_id = customer_idN:1The customer who placed this order.
Purchasesorder_id = order_id1:NThe lines this order is made of.
Sessionssession_id = session_idN:1The session this order was placed in.

Pages Data Mart

Pages

The catalog of pages that make up the storefront — path, display title, and the function each page serves (product, category, checkout and so on). It turns raw URL paths into something a business user can read, which is what makes funnel analysis by page type possible at all.

Fields

ColumnTypeAliasDescription
page_idINTEGERPage IDPK. Unique numerical identifier for each specific page on the website. FK to Pageviews
page_pathSTRINGPage PathThe URL path of the page relative to the domain root.
page_titleSTRINGPage TitleThe human-readable name or display title of the web page.
page_typeSTRINGPage TypeFunctional category of the page, such as Product, Category, or Checkout.

Relationships

Related data martOnCardinalityMeaning
Pageviewspage_id = page_id1:NEvery view of this page.

Pageviews Data Mart

Pageviews

Every page view recorded on the storefront, in sequence within its session — which page, which visitor, and where in the session the view sits. This is the finest grain in the model and the raw material for funnel and engagement analysis: the step-by-step path a shopper takes between arriving and buying.

Fields

ColumnTypeAliasDescription
dateDATEDateThe calendar date when the pageview occurred.
session_idSTRINGSession IDPK. Unique identifier for a specific user browsing session.
visitor_idSTRINGVisitor IDUnique identifier for an individual user or browser.
hit_numberINTEGERHit NumberPK. The sequential order of the pageview within a specific session.
page_idINTEGERPage IDUnique identifier for the specific page viewed by the visitor. FK to Pages
hit_timestampTIMESTAMPHit TimestampThe exact date and time when the pageview was recorded, in UTC.

Relationships

Related data martOnCardinalityMeaning
Pagespage_id = page_idN:1The page that was viewed.

Product Category Data Mart

Product Category

The category tree the catalog is organised by, together with the target margin each category is managed against and the person accountable for it. Because the target sits next to the category, actual margin from the order lines can be judged against what the category was supposed to deliver, not just reported in isolation.

Fields

ColumnTypeAliasDescription
category_idINTEGERCategory IDPK. Unique numerical identifier for each product category.
category_nameSTRINGCategory NameThe descriptive name of the product category used for reporting and classification.
category_managerSTRINGCategory ManagerFull name of the individual responsible for managing the specific product category.
target_marginFLOATTarget MarginThe desired profit margin percentage set for the category.
category_groupSTRINGCategory GroupHigh-level classification used to group related categories together, such as hard or soft goods.

Products Data Mart

Products

The product catalog: what the store sells, at what price, at what unit cost, and where each item lives in both the category tree and the website. Price and cost sitting in the same row is what makes unit margin a property of the product rather than something reconstructed downstream.

Fields

ColumnTypeAliasDescription
product_idINTEGERProduct IDPK. Unique identifier for a specific product in the catalog
product_nameSTRINGProduct NameThe full commercial name of the product
priceFLOATPriceThe current selling price of a single unit of the product
costFLOATCostThe acquisition cost or production expense per unit of the product
sub_categorySTRINGSub CategoryThe specific sub-classification of the product within its broader category.
category_idINTEGERCategory IDUnique identifier for the high-level category the product belongs to. FK to Product Category
page_pathSTRINGPage PathThe URL relative path for the product's detail page on the website.
page_idINTEGERPage IDUnique identifier for the specific web page associated with the product. FK to Pages

Relationships

Related data martOnCardinalityMeaning
Pagespage_id = page_idN:1This product's page on the storefront.
Product Categorycategory_id = category_idN:1The category this product sits in.

Purchases Data Mart

Purchases

The order lines behind every order — one row per product bought, with quantity, the price actually paid, the cost of goods, and the resulting revenue and profit. Revenue is recognised only for completed orders, so gross booked value and settled value never get confused. This is the mart that answers what the business actually earned.

Fields

ColumnTypeAliasDescription
purchase_idSTRINGPurchase IDPK. A unique identifier for each individual item row within an order
order_idSTRINGOrder IDThe unique identifier of the transaction. Used to join with the Orders Data Mart. FK to Orders
product_idINTEGERProduct IDThe unique identifier of the purchased product FK to Products
quantityINTEGERQuantityThe number of units of this specific product included in the purchase line
sale_priceFLOATItem Sale PriceThe price per unit at the moment of purchase
currencySTRINGCurrencyThe currency used for the transaction (e.g., USD)
unit_costFLOATUnit CostThe cost incurred by the business to acquire or produce a single unit of the product.
line_revenueFLOATItem RevenueGross revenue for this order line = Item Sale Price × Quantity. Sum across lines for total gross revenue (all order statuses).
line_costFLOATItem COGSCost of goods sold for this order line = Unit Cost × Quantity. Sum for total COGS.
line_net_revenueFLOATItem Net RevenueRevenue recognised only for Completed orders (Cancelled / Returned = 0). Sum for net revenue.
line_net_profitFLOATItem Net ProfitProfit for Completed orders = (Item Sale Price − Unit Cost) × Quantity, else 0. Sum for total net profit.
line_net_costFLOATItem Net COGSCost of goods sold recognised only for Completed orders (Cancelled / Returned = 0). This is the cost figure that pairs with Line Net Revenue: net revenue − net cost = net profit.
net_margin_pctFLOATNet Margin %Settled profit over settled revenue, from summed components.
margin_bucketSTRINGMargin BucketEach line's gross margin band — Thin, Standard, Healthy or Premium — from its sale price and unit cost, banded to how this store's margins actually spread (mid-40s to high-60s percent, not the wide range a generic Loss/Thin/Healthy/Premium split assumes). Row-level; group and filter by it.

Relationships

Related data martOnCardinalityMeaning
Ordersorder_id = order_idN:1The order this line belongs to.
Productsproduct_id = product_idN:1The product sold on this line.

Sessions Data Mart

Sessions

Every browsing session on the storefront, with the device it happened on, the traffic source and campaign that produced it, the market it came from, and whether it ended in an order. Sessions are the hinge of the model: marketing spend attaches on one side and orders on the other, which is what lets acquisition cost be weighed against revenue.

Fields

ColumnTypeAliasDescription
dateDATEDateThe specific date when the browsing session occurred FK to Unified Ad Spend
session_idSTRINGSession IDPK. Unique identifier for an individual user session FK to Pageviews
customer_idINTEGERCustomer IDUnique identifier of the customer associated with the session
device_categorySTRINGDevice CategoryThe type of hardware device used during the session (e.g., mobile, desktop)
conversion_seedFLOATConversion SeedA technical value used to simulate the probability of a transaction.
visitor_idSTRINGVisitor IDUnique identifier for the anonymous or recognized visitor. FK to Visitors
traffic_source_idINTEGERTraffic Source IDInternal numeric identifier for the marketing traffic source. FK to Traffic Sources
country_idINTEGERCountry IDNumeric identifier representing the geographic country of the visitor. FK to Countries
is_conversionBOOLEANIs ConversionIndicates whether the session resulted in a successful transaction or goal completion.
sourceSTRINGSourceThe origin of the traffic, such as Google, Facebook, or direct entry. FK to Unified Ad Spend
mediumSTRINGMediumThe high-level channel type of the traffic, such as organic or cost-per-click. FK to Unified Ad Spend
campaignSTRINGCampaignThe name of the specific marketing campaign that drove the session.
sessions_countINTEGERSessionsDistinct sessions in the selected rows.
orders_countINTEGEROrdersDistinct orders placed in those sessions, counted across the join.
conversion_rateFLOATConversion RateOrders per session — right at every cut. Inlined rather than composed over orders_count, because that formula reads a joined mart (Orders) and a formula may not read another formula that itself reads a join.
traffic_typeSTRINGTraffic TypePaid, Organic, Owned or Direct, from the medium. Row-level; group and filter by it.

Relationships

Related data martOnCardinalityMeaning
Countriescountry_id = country_idN:1The market the session came from.
Orderssession_id = session_id1:1The order this session produced, where it converted.
Pageviewssession_id = session_id1:NThe clickstream of this session.
Traffic Sourcestraffic_source_id = traffic_source_idN:1The channel that drove this session.
Unified Ad Spenddate = date, source = source, medium = mediumN:NSpend on the same day and channel — a cohort match, not this session's cost.
Visitorsvisitor_id = visitor_idN:1The visitor who browsed.

Traffic Sources Data Mart

Traffic Sources

Every source, medium and campaign combination that sends traffic to the storefront, grouped into the channels the business actually reports on and flagged for whether the traffic was paid. It is the vocabulary that makes marketing comparable: the same channel grouping applies to sessions, to customers and to advertising spend.

Fields

ColumnTypeAliasDescription
traffic_source_idINTEGERTraffic Source IDPK. Unique internal identifier for a specific combination of traffic source, medium, and campaign.
sourceSTRINGSourceThe origin of the website traffic, such as a search engine, social network, or domain.
mediumSTRINGMediumThe high-level category of the traffic source, such as organic, cost-per-click, or referral.
campaignSTRINGCampaign NameThe specific marketing campaign name associated with the traffic.
is_paidBOOLEANIs Paid TrafficIndicates whether the traffic was generated through a paid marketing channel.
channel_groupingSTRINGChannel GroupingThe classification of traffic into broad categories like Paid Marketing, Direct, or Organic.

Unified Ad Spend Data Mart

Unified Ad Spend

Advertising spend, clicks, impressions and each platform's own conversion claim, from every paid platform the business runs — Google, Facebook, TikTok, LinkedIn, Microsoft, Reddit and X — brought together on one daily grain with a common source, medium and campaign naming. Because it shares that naming with the storefront's traffic sources, spend can be set against the sessions and revenue it produced instead of being read on its own.

Unlike every other mart in this model, this one is defined by SQL inside the data mart itself rather than by a database view — on purpose. Each advertising platform is collected by its own connector-based data mart, each with a different schema and naming, and this query is how those separate marts are unified: seven SELECTs over the tables the connectors land in, normalised to one grain and UNION ALLed together. Open Data Setup to read it — every block is commented with the connector data mart it draws from and links straight to it, which is the shortest demonstration of how connector data becomes reportable with plain SQL.

Fields

ColumnTypeAliasDescription
dateDATEDatePK. The calendar date when the advertising activity occurred.
sourceSTRINGSourcePK. The name of the advertising platform or network where the traffic originated. FK to Traffic Sources
mediumSTRINGMediumPK. The marketing channel or payment model used, such as cost-per-click. FK to Traffic Sources
campaignSTRINGCampaignPK. The specific marketing campaign name associated with the ad spend. FK to Traffic Sources
spendFLOATSpendThe total cost of advertising incurred during the specified period.
clicksINTEGERClicksThe total number of times users clicked on the advertisements.
impressionsINTEGERImpressionsThe total number of times the advertisements were displayed to users.
platform_conversionsFLOATPlatform ConversionsThe number of conversion actions claimed by the advertising platform.
platform_conversion_valueFLOATPlatform Conversion ValueThe total monetary value of conversions as reported by the advertising platform.

Relationships

Related data martOnCardinalityMeaning
Traffic Sourcessource = source, medium = medium, campaign = campaignN:1The channel this spend was bought on.

Visitors Data Mart

Visitors

Everyone who has visited the storefront, registered or not: when they first and last appeared, how many sessions they ran, the channel that originally acquired them, the cohort month they belong to, and — where they later signed up — the customer account they became. This is where anonymous traffic and known customers meet, which makes cohort retention answerable.

Fields

ColumnTypeAliasDescription
visitor_idSTRINGVisitor IDPK. Unique identifier for the website visitor.
linked_customer_idINTEGERLinked Customer IDIdentifier of the registered customer account associated with this visitor, if applicable.
first_seen_dateDATEFirst Seen DateThe date when the visitor first interacted with the website.
last_seen_dateDATELast Seen DateThe date of the most recent recorded interaction from this visitor.
total_sessionsINTEGERTotal SessionsTotal number of distinct browsing sessions initiated by the visitor.
acquisition_sourceSTRINGAcquisition SourceThe specific platform or site that referred the visitor to the website.
acquisition_mediumSTRINGAcquisition MediumThe high-level channel type used to acquire the visitor, such as organic or paid search.
acquisition_campaignSTRINGAcquisition CampaignThe name of the marketing campaign that originally brought the visitor to the site.
cohort_monthDATECohort MonthThe month and year of the visitor's first visit, used for retention analysis.
visitor_segmentSTRINGVisitor SegmentClassification of the visitor based on their engagement behavior or frequency.
country_idINTEGERCountry IDNumeric identifier representing the country where the visitor is located.

Apply to your project

  1. 1

    Install the Import Model plugin

    One plugin, installed once, in your own OWOX workspace.

    Get the plugin →

  2. 2

    Import this model

    Point it at this bundle and it creates every data mart above, joins and all.

    Open the model →

  3. 3

    Plug in your data and destinations

    Connect your own sources and send the results where your team already works.

    Browse connectors →

4. Optional — customize as you wish. Rename a column, drop a mart, add your own: once it is imported it is yours, and nothing here syncs back.