Ecommerce Analytics & Data Analysis
Master ecommerce metrics - ROAS, CAC, LTV, conversion tracking, and funnel analysis.
0 of 5 concepts completed (0%)
What You'll Learn
Tutorial Contents
1.Key Metrics & Formulas
The Ecommerce Metrics Hierarchy ``` Level 1: Business Health Revenue = total sales Gross Profit = Revenue - COGS Gross Margin = Gross Profit / Revenue × 100
Level 2: Acquisition Efficiency CAC (Customer Acquisition Cost) = Marketing Spend / New Customers ROAS (Return on Ad Spend) = Revenue from Ads / Ad Spend × 100 CPA (Cost Per Acquisition) = Ad Spend / Conversions
Level 3: Revenue Per Customer AOV (Average Order Value) = Total Revenue / Total Orders LTV (Lifetime Value) = AOV × Purchase Frequency × Avg. Lifespan Repeat Purchase Rate = Customers with 2+ orders / All customers
Level 4: Funnel Performance Conversion Rate = Orders / Sessions × 100 Cart Abandonment Rate = 1 - (Purchases / Carts Created) Checkout Abandonment Rate = 1 - (Purchases / Checkouts Started)
Healthy benchmarks (industry varies): Conversion rate: 2-4% (desktop), 1-2% (mobile) Cart abandonment: 65-75% (goal: < 60%) ROAS: 400%+ (4:1) for most categories AOV increase from upsell: target 15-20% uplift ```
2.GA4 Enhanced Ecommerce Tracking
Complete Event Tracking Implementation ```javascript // Product List View (category/search page) gtag("event", "view_item_list", { item_list_id: "headphones", item_list_name: "Headphones Category", items: products.map((p, i) => ({ item_id: p.sku, item_name: p.title, item_brand: p.brand, item_category: p.category, price: p.price, index: i, quantity: 1, })), });
// Product Detail View gtag("event", "view_item", { currency: "USD", value: product.price, items: [{ item_id: product.sku, item_name: product.title, price: product.price, quantity: 1 }], });
// Add to Cart gtag("event", "add_to_cart", { currency: "USD", value: product.price * quantity, items: [{ item_id: product.sku, item_name: product.title, price: product.price, quantity }], });
// Begin Checkout gtag("event", "begin_checkout", { currency: "USD", value: cart.total, coupon: cart.couponCode, items: cart.items.map(i => ({ item_id: i.sku, price: i.price, quantity: i.qty })), });
// Purchase (fire on confirmation page) gtag("event", "purchase", { transaction_id: order.id, value: order.subtotal, tax: order.tax, shipping: order.shippingCost, currency: "USD", coupon: order.couponCode, items: order.lineItems.map(i => ({ item_id: i.sku, item_name: i.title, item_brand: i.brand, item_category: i.category, price: i.price, discount: i.discountAmount, quantity: i.quantity, })), }); ```
Cohort Analysis in Looker Studio
``sql
-- Monthly cohort retention query (BigQuery + GA4)
WITH first_purchase AS (
SELECT user_pseudo_id,
MIN(DATE_TRUNC(PARSE_DATE('%Y%m%d', event_date), MONTH)) AS cohort_month
FROM project.analytics_xxx.events_*
WHERE event_name = 'purchase'
GROUP BY 1
),
purchases AS (
SELECT user_pseudo_id,
DATE_TRUNC(PARSE_DATE('%Y%m%d', event_date), MONTH) AS purchase_month
FROM project.analytics_xxx.events_*
WHERE event_name = 'purchase'
)
SELECT
fp.cohort_month,
DATE_DIFF(p.purchase_month, fp.cohort_month, MONTH) AS months_since_first,
COUNT(DISTINCT p.user_pseudo_id) AS customers
FROM first_purchase fp
JOIN purchases p USING (user_pseudo_id)
GROUP BY 1, 2
ORDER BY 1, 2;
``
Code Example
// Ecommerce Analytics Implementation (GA4)
// Purchase event with items
gtag('event', 'purchase', {
'transaction_id': 'T12345',
'affiliation': 'Online Store',
'value': 299.99,
'tax': 29.99,
'shipping': 10.00,
'currency': 'USD',
'coupon': 'SUMMER20',
'items': [
{
'item_id': 'SKU001',
'item_name': 'Blue Wireless Headphones',
'affiliation': 'Google Store',
'coupon': 'SUMMER20',
'currency': 'USD',
'discount': 60.00,
'index': 0,
'item_brand': 'AudioBrand',
'item_category': 'Audio',
'item_list_id': 'Related products',
'item_list_name': 'Related products',
'item_variant': 'Blue',
'price': 299.99,
'quantity': 1
}
]
});
// Key Formulas:
// ROAS = Revenue / Ad Spend
// CAC = Marketing Spend / Number of Customers
// LTV = Average Order Value × Average Orders per Year × Avg Customer Lifespan
// AOV = Total Revenue / Number of Orders
// Conversion Rate = Orders / Website SessionsPro Tips
- 1ROAS > 3x is profitable for most businesses. Below 2x usually means you're losing money when you factor in COGS, shipping, and overhead.
- 2LTV:CAC ratio should be at least 3:1. If it costs $50 to acquire a customer who spends $60 lifetime, your business model doesn't work.
- 3Cohort analysis by acquisition month shows you whether customers are improving or declining in retention. A single 'average retention' number hides this.
- 4Set up GA4 Enhanced Ecommerce on day 1 you can't retroactively track historical product impressions, add-to-cart events, or checkout funnel data.
Topics Covered
Continue Learning
Explore the official documentation and deepen your knowledge with real-world practice.
Explore the Full Portfolio
This is the complete portfolio of Sufi Khan Sulaiman, a technology leader specialising in B2B commerce and digital automation. Start from the Home page for the overview, then move through two decades of career experience across FLIR Systems, Lorex Technology, and 1c Platform, and the full catalogue of project case studies spanning headless commerce migrations, AI recommendation engines, and multi-channel fulfilment systems.
The skills and certifications page maps the technical and leadership capabilities behind the work, while the articles and the knowledge base break down the thinking into actionable frameworks. For hands-on learning, the tutorials and applications sections cover practical builds from front-end fundamentals to full-stack web apps.
For consulting engagement, the expertise page outlines service offerings, the ecommerce hub covers platform architecture and automation strategy, and the ecommerce guide (PDF) is a downloadable 55-page field manual. When you are ready to talk, the contact page is the direct line.