MinAI - Về trang chủ
Lý thuyết
6/1355 phút
Đang tải...

Cohort & Retention Analysis

Monthly cohort analysis, retention curves, churn rate và chiến lược giữ chân khách hàng

0

🎯 Mục tiêu bài học

TB5 min
Sau bài học này, bạn sẽ:
  • Hiểu khái niệm Cohort và tại sao phân tích theo cohort quan trọng hơn aggregate metrics
  • Xây dựng Cohort Retention Table hoàn chỉnh bằng SQL
  • Vẽ và đọc Retention Curves — phát hiện trends và anomalies
  • Tính toán Churn Rate và hiểu mối quan hệ với Retention
  • So sánh retention theo segments để tìm insight actionable
📋 Thông tin bài học
Thông tinChi tiết
⏱️ Thời lượng55 phút
📖 Chủ đề chínhCohort Analysis, Retention, Churn
💡 Kiến thức cần cóBài 01-05, SQL Window Functions
🎯 OutputCohort retention table cho ShopVN
1

📖 Thuật ngữ quan trọng

TB5 min
Thuật ngữTiếng ViệtMô tả
CohortNhóm đồng đạiNhóm khách hàng chia theo thời điểm đầu tiên (first purchase month)
Retention RateTỷ lệ giữ chân% khách hàng quay lại mua ở tháng N sau tháng đầu
Churn RateTỷ lệ rời bỏ% khách hàng không quay lại = 1 - Retention
Cohort SizeKích thước cohortSố khách hàng trong mỗi cohort
Month 0Tháng gốcTháng khách hàng mua lần đầu tiên
Month NTháng thứ NN tháng sau tháng gốc
Retention CurveĐường cong giữ chânBiểu đồ retention rate theo thời gian
StickinessĐộ dínhMức độ quay lại thường xuyên (DAU/MAU)
ResurrectionHồi sinhKhách hàng quay lại sau thời gian dài không mua
Average LifespanVòng đời trung bìnhThời gian trung bình khách hàng active

Checkpoint

Cohort = nhóm khách hàng theo tháng mua đầu tiên. Retention Rate đo % khách quay lại ở tháng N. Churn Rate = 1 - Retention Rate. Retention Curve giảm dần theo thời gian — tốc độ giảm phản ánh chất lượng sản phẩm/dịch vụ.

2

📊 Tại sao phân tích Cohort?

TB5 min

Vấn đề của Aggregate Metrics

Aggregate metrics che giấu sự thật

Khi nhìn tổng số đơn hàng tăng 20% MoM, bạn nghĩ business đang tốt. Nhưng thực tế có thể là:

  • ✅ Khách cũ mua lại nhiều hơn → Tốt (retention cao)
  • ❌ Chỉ có khách mới, khách cũ đã rời đi → Xấu (churn cao)

Cohort Analysis giúp tách biệt hành vi khách cũ vs khách mới, cho thấy bức tranh thực.

So sánh 2 scenario

ScenarioTháng 1Tháng 2Tháng 3Aggregate Growth
A (Tốt)1000 new + 0 return800 new + 300 return600 new + 500 return+10% MoM
B (Xấu)1000 new + 0 return1100 new + 50 return1200 new + 30 return+15% MoM
Scenario B tăng trưởng nhanh hơn nhưng KHOẺ KÉM HƠN

Scenario B có growth rate cao hơn (15% vs 10%) nhưng retention cực thấp (5% vs 30%). Khi chi phí thu hút khách mới (CAC) tăng, Scenario B sẽ sụp đổ. Cohort Analysis phát hiện vấn đề này.

3

💻 Xây dựng Cohort Table bằng SQL

TB5 min

Step 1: Xác định Cohort Month cho mỗi khách

SQL
1-- Step 1: First purchase month = cohort month
2WITH customer_cohort AS (
3 SELECT
4 customer_id,
5 MIN(order_date) AS first_order_date,
6 FORMAT(MIN(order_date), 'yyyy-MM') AS cohort_month
7 FROM fact_orders
8 WHERE status = 'Delivered'
9 GROUP BY customer_id
10),
11
12-- Step 2: Gắn cohort month vào mỗi order
13orders_with_cohort AS (
14 SELECT
15 o.customer_id,
16 o.order_date,
17 c.cohort_month,
18 c.first_order_date,
19 DATEDIFF(MONTH, c.first_order_date, o.order_date) AS month_number
20 FROM fact_orders o
21 JOIN customer_cohort c ON o.customer_id = c.customer_id
22 WHERE o.status = 'Delivered'
23),
24
25-- Step 3: Đếm unique customers ở mỗi month_number
26cohort_data AS (
27 SELECT
28 cohort_month,
29 month_number,
30 COUNT(DISTINCT customer_id) AS customers
31 FROM orders_with_cohort
32 GROUP BY cohort_month, month_number
33),
34
35-- Step 4: Lấy cohort size (month_number = 0)
36cohort_sizes AS (
37 SELECT
38 cohort_month,
39 customers AS cohort_size
40 FROM cohort_data
41 WHERE month_number = 0
42)
43
44-- Step 5: Retention Rate Table
45SELECT
46 d.cohort_month,
47 s.cohort_size,
48 d.month_number,
49 d.customers AS retained_customers,
50 ROUND(d.customers * 100.0 / s.cohort_size, 1) AS retention_rate_pct
51FROM cohort_data d
52JOIN cohort_sizes s ON d.cohort_month = s.cohort_month
53WHERE d.month_number <= 12
54ORDER BY d.cohort_month, d.month_number;

Đọc Cohort Table

CohortSizeM0M1M2M3M6M12
2024-015,000100%25%18%15%10%7%
2024-024,800100%27%20%16%11%
2024-035,200100%24%17%14%9%
2024-045,500100%28%21%17%
Cách đọc Cohort Table

Đọc theo hàng: Cohort 2024-01 (5,000 khách mới tháng 1), đến tháng 3 (M3) còn 15% quay lại mua = 750 khách. Đọc theo cột: So sánh M1 giữa các cohort — nếu M1 tăng dần từ 25% lên 28% → platform đang improve retention.

Checkpoint

Cohort Table có hàng = cohort month (tháng mua đầu tiên), cột = month_number (0, 1, 2...). Month 0 luôn 100%. Retention rate giảm dần theo tháng. So sánh cùng cột giữa các cohort cho thấy improvement hoặc degradation.

4

📈 Retention Curves & Patterns

TB5 min

Đặc điểm Retention Curve E-commerce

Retention Curve Pattern

📉M0→M1: Drop mạnh
📊M3-M6: Ổn định dần
M6+: Flatten out

Benchmark Retention Rate E-commerce

ThángPoorAverageGoodExcellent
M1dưới 15%20-25%25-35%trên 35%
M3dưới 8%10-15%15-20%trên 22%
M6dưới 5%7-10%10-15%trên 15%
M12dưới 3%5-7%7-12%trên 12%
E-commerce Retention thường thấp

E-commerce có retention thấp hơn SaaS hoặc subscription business vì khách hàng mua theo nhu cầu (not recurring). Retention M12 khoảng 5-10% là bình thường. Focus vào việc tăng M1 retention sẽ có impact lớn nhất.

Retention theo Customer Segment

SQL
1-- Retention Rate theo customer segment
2WITH customer_cohort AS (
3 SELECT
4 o.customer_id,
5 c.customer_segment,
6 MIN(o.order_date) AS first_order_date,
7 DATEDIFF(MONTH, MIN(o.order_date), o.order_date) AS month_number
8 FROM fact_orders o
9 JOIN dim_customer c ON o.customer_id = c.customer_id
10 WHERE o.status = 'Delivered'
11 GROUP BY o.customer_id, c.customer_segment,
12 DATEDIFF(MONTH, MIN(o.order_date), o.order_date)
13)
14SELECT
15 customer_segment,
16 COUNT(DISTINCT CASE WHEN month_number = 0
17 THEN customer_id END) AS m0_customers,
18 COUNT(DISTINCT CASE WHEN month_number = 1
19 THEN customer_id END) AS m1_customers,
20 COUNT(DISTINCT CASE WHEN month_number = 3
21 THEN customer_id END) AS m3_customers,
22 ROUND(
23 COUNT(DISTINCT CASE WHEN month_number = 1 THEN customer_id END) * 100.0
24 / NULLIF(COUNT(DISTINCT CASE WHEN month_number = 0 THEN customer_id END), 0)
25 , 1) AS m1_retention_pct
26FROM customer_cohort
27GROUP BY customer_segment
28ORDER BY m1_retention_pct DESC;
5

📉 Churn Analysis

TB5 min

Churn Rate = 1 - Retention Rate

SQL
1-- Monthly Churn Rate
2WITH monthly_active AS (
3 SELECT
4 FORMAT(order_date, 'yyyy-MM') AS month,
5 COUNT(DISTINCT customer_id) AS active_customers
6 FROM fact_orders
7 WHERE status = 'Delivered'
8 GROUP BY FORMAT(order_date, 'yyyy-MM')
9),
10monthly_new AS (
11 SELECT
12 FORMAT(MIN(order_date), 'yyyy-MM') AS first_month,
13 COUNT(DISTINCT customer_id) AS new_customers
14 FROM fact_orders
15 WHERE status = 'Delivered'
16 GROUP BY customer_id
17)
18SELECT
19 a.month,
20 a.active_customers,
21 COALESCE(n.new_customers, 0) AS new_this_month,
22 a.active_customers - COALESCE(n.new_customers, 0) AS returning_customers,
23 ROUND(
24 (a.active_customers - COALESCE(n.new_customers, 0)) * 100.0
25 / LAG(a.active_customers) OVER (ORDER BY a.month), 1
26 ) AS returning_rate_pct
27FROM monthly_active a
28LEFT JOIN (
29 SELECT first_month, SUM(new_customers) AS new_customers
30 FROM monthly_new
31 GROUP BY first_month
32) n ON a.month = n.first_month
33ORDER BY a.month;

Nguyên nhân Churn phổ biến

Nguyên nhânTỷ lệGiải pháp
Trải nghiệm giao hàng kém30%Cải thiện fulfillment, theo dõi delivery
Sản phẩm không đúng mô tả25%Kiểm soát chất lượng listing
Giá không cạnh tranh20%Dynamic pricing, price matching
Thiếu chương trình loyalty15%Reward points, membership tiers
Trải nghiệm app/web kém10%UX improvement, page speed
Giảm Churn hiệu quả hơn tăng Acquisition

Giảm churn 5% có thể tăng lợi nhuận 25-95% (Harvard Business Review). Lý do: khách cũ đã quen sản phẩm, không cần chi phí acquisition, và order thường lớn hơn khách mới.

6

📋 Tổng kết

TB5 min

Kiến thức đã học

Chủ đềNội dung chính
Cohort AnalysisNhóm khách theo first purchase month, theo dõi qua thời gian
Retention TableHàng = cohort, cột = month_number, giá trị = retention %
SQL ImplementationMIN(order_date) → DATEDIFF → COUNT DISTINCT → %
Retention CurvesDrop mạnh M0→M1 (70-80%), flatten out sau M6
Churn AnalysisChurn = 1 - Retention, top reasons và solutions
BenchmarkM1: 20-25%, M6: 7-10%, M12: 5-7% cho E-commerce

Key Takeaways

  1. Cohort Analysis phát hiện vấn đề mà aggregate metrics che giấu
  2. M1 Retention là metric quan trọng nhất — cải thiện M1 impact toàn bộ curve
  3. Churn rate giảm 5% có thể tăng profit 25-95%
  4. ✅ So sánh retention giữa các cohort cho thấy improvement efforts có hiệu quả không

Bài tiếp theo: Product Analytics →

🎉 Bạn đã thành thạo Cohort & Retention Analysis! Module tiếp theo sẽ chuyển sang phân tích sản phẩm và vận hành.