E-commerce Marketing and Growth · Unit economics and e-commerce analytics · lesson 19 of 20 · 11 min
E-commerce analytics: cohorts, customers and dashboards
From reports to decisions
E-commerce generates rich data: sessions, product views, carts, orders, customers, returns and marketing costs. The goal is to turn it into decisions about products, marketing and retention.
Core analytics sources
- Web analytics (such as GA4) for traffic, behaviour and funnel analysis.
- Store platform reports for orders, products, customers and discounts.
- Marketing platforms for spend and platform-attributed results.
- Email/SMS tools for lifecycle performance.
- Finance and operations for cost of goods, shipping, returns and cash.
Reconcile them: GA4 purchases, store orders and platform-reported conversions will differ. Decide which source is the "source of truth" for each metric (usually the store platform for orders and revenue).
Funnel analysis
Sessions -> Product views -> Add to cart -> Checkout started -> Purchase
Segment by device, traffic source, new vs returning and country to find leaks. Compare against your own history rather than generic benchmarks.
Product analytics
- Product views, add-to-cart rate and conversion rate per product.
- Revenue, margin and return rate per product.
- Products frequently bought together (bundle and cross-sell ideas).
- Out-of-stock impact.
- "Hero" products that bring new customers versus products bought by repeat customers.
Cohort analysis
A cohort is a group of customers who made their first purchase in the same period (for example, January 2026). Cohort tables show how each group behaves over time:
First-purchase month | Customers | % ordering again by Month 1 | Month 3 | Month 6 | Month 12
Jan | 1,000 | 8% | 15% | 21% | 28%
Feb | 1,200 | 9% | 17% | 24% | —
Mar (big promo) | 2,500 | 5% | 9% | — | —
(Illustrative.) In this example, the March cohort — acquired with a big promotion — repeats less, suggesting discount-driven customers are less loyal. Cohorts reveal patterns that averages hide.
RFM segmentation
RFM scores customers by:
- Recency: how recently they purchased.
- Frequency: how often they purchase.
- Monetary value: how much they spend.
Segments such as "champions" (recent, frequent, high value), "at risk" (previously frequent, not recent), and "new" guide lifecycle marketing: VIP perks for champions, win-back campaigns for at-risk customers, onboarding for new ones.
Building an e-commerce dashboard
EXECUTIVE (weekly)
- Net revenue, orders, AOV, conversion rate
- Contribution margin (after marketing)
- MER and blended CAC; new vs returning customer revenue
- Repeat purchase rate; return rate
MARKETING (daily/weekly)
- Spend, platform ROAS, new customers by channel
- Creative performance; email/SMS revenue per recipient
MERCHANDISING (weekly)
- Top and bottom products by revenue, margin, conversion and returns
- Stock levels for top sellers; zero-result searches
Each metric should have a comparison (previous period, same period last year, target) and an owner.
Privacy and data quality
- Respect consent for analytics and marketing tags.
- Avoid storing unnecessary personal data in spreadsheets.
- Document metric definitions (for example, whether revenue includes tax or shipping).
- Monitor tracking health after site changes.
Worked example: a Gulf home-fragrance brand
Cohort analysis shows customers acquired via a creator partnership reorder at twice the rate of those from a discount-heavy campaign (illustrative). RFM shows a growing "at risk" segment of past frequent buyers. Actions: scale creator partnerships, reduce deep discount acquisition, launch a win-back flow for at-risk customers with new scents rather than discounts.
Hands-on: GA4 ecommerce events you should see
GA4's recommended ecommerce events create the funnel and product reports. Check they fire once, with the right parameters (currency, value, items[] with item_id, item_name, price, quantity):
view_item_list -> select_item -> view_item -> add_to_cart -> view_cart -> begin_checkout
-> add_shipping_info -> add_payment_info -> purchase (with transaction_id) ; refund
Platform apps (Shopify's Google & YouTube channel, Google for WooCommerce) send many of these automatically; verify with GA4 DebugView and a test order, and after any checkout change.
Hands-on: repeat rate by cohort with the GA4 BigQuery export
If you link GA4 to BigQuery (free export available), you can build cohorts from raw events. Your store backend remains the source of truth for orders, refunds and customers — many teams export orders from Shopify/WooCommerce into the warehouse and join.
-- Share of customers from each first-purchase month who purchased again within 90 days
-- (GA4 export; requires a stable user_id set at login/checkout; illustrative)
WITH purchases AS (
SELECT user_id, DATE(TIMESTAMP_MICROS(event_timestamp)) AS d
FROM `your-project.analytics_123456789.events_*`
WHERE event_name = 'purchase' AND user_id IS NOT NULL
),
firsts AS (
SELECT user_id, MIN(d) AS first_d FROM purchases GROUP BY user_id
)
SELECT
FORMAT_DATE('%Y-%m', f.first_d) AS cohort,
COUNT(DISTINCT f.user_id) AS customers,
SAFE_DIVIDE(COUNT(DISTINCT IF(p.d > f.first_d AND p.d <= DATE_ADD(f.first_d, INTERVAL 90 DAY), p.user_id, NULL)),
COUNT(DISTINCT f.user_id)) AS repeat_90d
FROM firsts f
LEFT JOIN purchases p USING (user_id)
GROUP BY cohort
ORDER BY cohort;
Hands-on: RFM segments in Python (from a backend order export)
import csv
from datetime import date, datetime
from collections import defaultdict
today = date(2026, 9, 30)
cust = defaultdict(lambda: {"last": None, "orders": 0, "spend": 0.0})
with open("orders.csv", newline="", encoding="utf-8") as f: # customer_id, order_date (YYYY-MM-DD), net_value
for r in csv.DictReader(f):
c = cust[r["customer_id"]]
d = datetime.strptime(r["order_date"], "%Y-%m-%d").date()
c["last"] = max(c["last"], d) if c["last"] else d
c["orders"] += 1
c["spend"] += float(r["net_value"])
def segment(c):
recency = (today - c["last"]).days
if recency <= 90 and c["orders"] >= 3: return "champions"
if recency <= 90: return "recent"
if recency <= 240 and c["orders"] >= 2: return "at_risk_loyal"
return "lapsed"
counts = defaultdict(int)
for c in cust.values():
counts[segment(c)] += 1
print(dict(counts))
Use the segments in email/SMS flows (VIP early access for champions, win-back for lapsed) and to size retention opportunities.
Privacy and data quality
Consent choices, ad blockers and browser protections mean analytics undercounts; GA4's consent mode can model some gaps. Reconcile GA4 purchases with backend orders monthly, keep personal data out of analytics event parameters, and document every metric definition (net or gross revenue? including VAT? before or after returns?).
Common mistakes
- Relying on averages that hide cohort differences.
- Mixing data sources without reconciliation.
- Dashboards without targets or owners.
- Tracking revenue but not contribution.
- Ignoring returns in product performance.
Common analysis questions to answer monthly
- Which channels brought the most new customers, and at what CAC?
- How are recent cohorts repeating compared with earlier ones?
- Which products drive first purchases, and which drive repeat purchases?
- Where in the funnel did conversion change most, and for which segment?
- Which products have rising return rates, and why?
Analytics checklist
- [ ] Source of truth defined for each key metric
- [ ] Funnel segmented by device, source and customer type
- [ ] Monthly cohort table maintained
- [ ] RFM segments feeding lifecycle marketing
- [ ] Dashboards with comparisons, targets and owners
Video lecture: E-commerce analytics: cohorts, customers and dashboards
Lecture coming soon · 15 chapters · about 8 minutes. Read the full transcript below.
- Ecommerce analytics
- Why analytics matters
- Core sources
- Funnel and products
- Cohort analysis
- RFM segmentation
- Simple example: Gulf home fragrance
- Product analytics
- Realistic example: UK apparel warehouse (illustrative)
- Watch me do it: cohorts + RFM
- A decision dashboard
- Privacy and data quality
- AI in analytics
- Common mistakes
- Recap
Lecture transcript
Ecommerce analytics
Most ecommerce teams have more data than ever, and still struggle to answer simple questions. Are our new customers coming back? Which products bring in customers who buy again? Is conversion falling on mobile? In this lecture you'll learn the core analytics sources, funnel and product analysis, cohort analysis, RFM segmentation, how to build a dashboard that drives decisions, and the privacy and data-quality issues that make or break trust. Then you'll watch me calculate repeat rate by cohort with a SQL query, and build RFM segments in Python.
Why analytics matters
Why does analytics matter? Because every other lesson in this course depends on measurement: the growth levers, promotions, retention flows, partners and paid ads. Without trustworthy numbers, you'll argue about opinions. With them, you can see which lever is limiting growth, which customers are worth acquiring, and whether changes worked. The goal isn't more dashboards. It's better decisions.
Core sources
The core sources. Your store platform, like Shopify or WooCommerce, is the source of truth for orders, refunds, products and customers. Web analytics, like GA4, shows sessions, traffic sources, funnels and on-site behaviour. Ad platforms report their own attributed results. Email and SMS tools report flow and campaign performance. Marketplaces have their own seller analytics. And customer service tools show contact reasons. Each sees part of the picture. The skill is combining them without double counting.
Funnel and products
Funnel and product analysis. GA4's recommended ecommerce events create the funnel: view item list, select item, view item, add to cart, view cart, begin checkout, add shipping info, add payment info, and purchase with a transaction ID. Platform apps send many of these automatically, but verify them in DebugView with a test order, especially after checkout changes. Then analyse products: views to add-to-cart rate, add-to-cart to purchase rate, revenue, margin and return rate. Products with high views but low add-to-cart need better pages or pricing.
Cohort analysis
Cohort analysis is the most important view most stores don't look at. A cohort is a group of customers who made their first purchase in the same period, like March. You track what share of them buy again within thirty, ninety or a hundred and eighty days, and how much contribution they generate over time. Cohorts show whether retention is improving, which acquisition channels bring customers who come back, and whether a promotion attracted one-time bargain hunters. Averages hide all of that.
RFM segmentation
RFM segmentation groups customers by recency, how recently they bought, frequency, how often, and monetary value, how much. Simple segments are enough to start: champions who bought recently and often, recent first-time buyers, loyal customers who are at risk because they haven't bought in a while, and lapsed customers. Each segment gets a different message: early access for champions, a helpful second-purchase nudge for new buyers, a check-in for at-risk loyals, and a win-back for lapsed customers.
Simple example: Gulf home fragrance
A simple example. A Gulf home-fragrance brand looks at cohorts for the first time. Customers acquired during a big Ramadan discount had a much lower ninety-day repeat rate than customers acquired through creator content at full price. Revenue looked similar in both months. The team shifts budget towards creator-led acquisition and changes the Ramadan offer to a gift with purchase rather than a deep discount.
Product analytics
Let's think about product analytics a little more, because it's where many quick wins hide. For each product, look at views, add-to-cart rate, purchase rate, revenue, margin, return rate and review rating side by side. Patterns jump out. High views and a low add-to-cart rate usually mean the page, the price or the stock status needs work. A high add-to-cart rate but a low purchase rate can point to delivery costs or a checkout problem for that product. High sales with high returns can mean the photos or sizing mislead. And products with strong repeat purchase rates deserve a bigger place in acquisition, because they bring customers who come back.
Realistic example: UK apparel warehouse (illustrative)
Now a realistic scenario with illustrative details. A UK apparel brand links GA4 to BigQuery and exports Shopify orders into the same warehouse. Their dashboard previously showed only revenue and ROAS. Now it shows ninety-day repeat rate by first-purchase month and by acquisition channel, contribution margin after returns by product, and a monthly reconciliation of GA4 purchases against Shopify orders. The first month's reconciliation reveals that GA4 is missing a noticeable share of purchases after a checkout change. They fix the tracking before trusting any other report.
Watch me do it: cohorts + RFM
Watch me calculate repeat rate by cohort. In BigQuery, with the GA4 export, I write a query in three steps. First, all purchase events with a user ID and date. Second, each user's first purchase date. Third, for each first-purchase month, the number of customers and the share who purchased again within ninety days. I run it and get a table: cohort, customers, and repeat rate. One caution: this relies on a stable user ID set at login or checkout, and the store backend remains the source of truth, so many teams join backend orders instead. Then, in Python, I load an order export and assign each customer an RFM segment for our email flows.
A decision dashboard
Building a dashboard that drives decisions. One page for leadership, reviewed monthly: revenue and contribution margin after marketing, MER, new versus returning revenue, conversion rate by device, average order value, ninety-day repeat rate for recent cohorts, return rate, and CAC by main channel. Each metric has a written definition and an owner. And each review ends with decisions, not just observations.
Privacy and data quality
Privacy and data quality. Consent choices, ad blockers and browser protections mean analytics undercounts, and GA4's consent mode can model some of the gaps. Reconcile GA4 purchases with backend orders every month. Keep personal data out of analytics event parameters. And document every definition: is revenue net or gross, including VAT or not, before or after returns? Many analytics arguments are really definition arguments.
AI in analytics
A word on AI in analytics. Many analytics tools now answer questions in plain language, and AI assistants can analyse exported order data, build cohort tables and write summaries. That's genuinely useful for speed. But analytics mistakes are easy to make and hard to spot. So keep exports free of personal data, ask the assistant to show every calculation and the exact definitions it used, check a couple of numbers against your backend, and make sure summaries include caveats like missing tracking or consent gaps. An AI summary that nobody verifies is just a confident guess with a chart attached.
Common mistakes
Common mistakes. Too many dashboards and no decisions. Trusting GA4 revenue over backend orders. No cohort view. Mixing gross and net revenue. Personal data in analytics. Never checking tracking after site changes. And AI-generated summaries of dashboards that nobody verifies.
Recap
Recap. Treat your store platform as the source of truth, GA4 as the behaviour view, and reconcile them monthly. Verify ecommerce events, analyse products, use cohorts to see who comes back, and use RFM segments to tailor messages. Build one decision dashboard with written definitions and owners. Try this now: run the cohort query or an equivalent report from your store platform for the last six months, and create four RFM segments with the Python script from the lesson text.
Key takeaways
- Reconcile data sources and define a source of truth for each metric.
- Cohort analysis reveals how customer groups behave over time.
- RFM segmentation guides VIP, win-back and onboarding marketing.
- Dashboards need comparisons, targets, owners and contribution metrics.
Try it
Build a cohort table from your store data (or a sample dataset) and define three RFM segments with a marketing action for each.