mcpField
C
customer-lifetime-value

customer-lifetime-value

github.com/finsilabs数据与数据库6089 次安装1 周前更新
代码仓库

关于 customer-lifetime-value

用于衡量客户生命周期价值并将其应用于电商决策的技能。它指导店铺运营者使用平台分析、预测评分、客户分群和留存措施,也介绍无头店铺的自定义模型。

主要功能

  1. 01历史与预测 CLV 指南
  2. 02按平台介绍分析流程
  3. 03基于 CLV 的客户分群
  4. 04针对流失风险的挽回流程
  5. 05自定义参数模型与 BG/NBD 模型

适用场景

  1. 01依据 CLV 设定获客 CAC 上限
  2. 02量化制定 VIP 客户等级
  3. 03触达有流失风险的高价值客户
  4. 04衡量忠诚度与留存计划的 ROI

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/finsilabs/awesome-ecommerce-skills --skill customer-lifetime-value

安装后在 Claude Code 中输入/customer-lifetime-value确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

tile.json
evals/bg-nbd-probabilistic-clv-model-with-life/
criteria.json
task.md
evals/parametric-clv-and-churn-probability-cal/
criteria.json
task.md
evals/retention-automation-and-clv-based-tier-/
criteria.json
task.md

详细介绍

客户生命周期价值

概述

客户生命周期价值(CLV)用于衡量预期客户在与店铺保持关系期间带来的净收入总额,帮助你更明智地制定获客支出、留存投入和客户层级管理决策。大多数平台都原生提供历史 CLV 计算(截至目前的累计消费额)。如需预测 CLV 和流失风险评分,可使用专门的分析应用(Klaviyo、Metorik、Triple Whale),或为拥有 10k+ 客户的店铺构建自定义模型。

何时使用此技能

  • 根据预期回报为获客渠道设定 CAC 目标时
  • 构建需要量化门槛的 VIP 层级计划时
  • 预测哪些客户可能流失并触发挽回自动化流程时
  • 计算留存计划(忠诚积分、VIP 福利)的 ROI 时
  • 按预测的未来价值而非仅按历史消费额对客户进行细分时

核心说明

步骤 1:确定平台并选择合适的 CLV 工具
平台历史 CLV预测 CLV
Shopify内置:Admin → Analytics → Customers(显示生命周期消费额)使用 Triple Whale、Lifetimely 或 Klaviyo 进行预测评分
WooCommerce使用 Metorik 或 WooCommerce Analytics → Customers 报告使用 Metorik Pro 预测流失;使用 Klaviyo 集成创建基于 CLV 的工作流
BigCommerce内置客户分析;使用 Google Analytics 4 进行群组分析使用 Klaviyo 或 Metorik 预测 CLV
Custom / Headless针对订单数据库编写 SQL 查询基于历史数据构建参数模型或 BG/NBD 模型

步骤 2:查看并跟踪历史 CLV

历史 CLV 是客户带来的所有收入之和。平台均提供原生查看功能。

Shopify
  1. 前往 Admin → Analytics → Reports → Customers over time — 查看各群组的客户总数、订单数和收入
  2. 前往 Admin → Customers → [Customer] — 每个客户资料页都会显示累计消费额、订单数和最近订单日期
  3. 如需批量导出:前往 Customers → Export — CSV 中包含每位客户的 Total Spent 和 Number of Orders

更高级的 CLV 报告:

  • 从 App Store 安装 Lifetimely — 提供基于群组的 LTV 曲线、按获客渠道划分的回本周期以及未来消费额预测
  • 安装 Triple Whale — 提供按获客来源划分的 CLV、群组分析和归因建模
WooCommerce
  1. 前往 WooCommerce → Analytics → Customers — 查看每位客户的生命周期价值、订单数和平均订单金额
  2. 按 Lifetime value 降序排序,查看你的顶级客户
  3. 按日期范围筛选,查看特定获客群组的 CLV

使用 Metorik 进行深入分析:

  • 安装 Metorik(通过 WooCommerce REST API 连接)
  • Metorik 的客户控制面板会显示 CLV 分布、群组留存情况,并自动标记有流失风险的客户
  • Metorik Pro 增加流失概率评分和自动挽回邮件触发功能
BigCommerce
  1. 前往 Analytics → Customers,查看客户消费情况摘要
  2. 单个客户资料页会显示订单总数和生命周期消费额
  3. 如需进行群组分析:连接 Google Analytics 4 并使用 User Lifetime 报告

步骤 3:设置基于 CLV 的客户细分

能够衡量 CLV 后,创建细分群组,以不同的信息触达不同价值层级的客户。

Shopify + Klaviyo
  1. 在 Klaviyo 中,前往 Lists & Segments → Create Segment
  2. 创建一个“VIP Customers”细分群组:Customer → Predicted CLV is greater than $500(Klaviyo 会自动为 Shopify 商店计算预测 CLV)
  3. 创建一个“At Risk - High Value”细分群组:Customer → Predicted CLV > $200 AND Last order date is more than 90 days ago
  4. 将这些细分群组用作定向邮件工作流的受众

Klaviyo 的预测分析(付费方案提供):

  • Klaviyo 会为每个用户档案显示 Predicted CLV、Churn Risk 和 Predicted Next Order Date
  • 可在 Analytics → Predictive Analytics 中或单个客户的用户档案页面上找到这些信息
  • 无需编写自定义代码,即可使用这些预测作为细分群组筛选条件
WooCommerce + Klaviyo
  1. 从 WordPress.org 安装 Klaviyo for WooCommerce
  2. Klaviyo 会自动同步客户的购买历史
  3. 按照上述说明创建相同的 CLV 细分群组

第 4 步:根据 CLV 和流失风险自动执行留存操作

定义细分群组后,为每个层级创建自动化工作流。

针对高价值且有流失风险客户的挽回工作流:

Klaviyo(所有平台):

  1. 前往 Flows → Create Flow → Win-Back
  2. 设置触发条件:客户进入“At Risk - High Value”细分群组
  3. 配置序列:
    • 第 0 天:发送个性化邮件——“我们想念你”,并根据购买历史推荐产品
    • 第 7 天:发送附带小额优惠的邮件(免运费或优惠 10%)
    • 第 14 天:由“创始人”或客户成功团队发送最后一封邮件
  4. 如果客户完成购买,则停止工作流(添加工作流筛选条件:“Ordered zero times since starting this flow”)

VIP 层级认可:

  1. 创建一个 VIP 细分群组(CLV > $500 或订单数达到 5+)
  2. 客户进入该细分群组时,发送个性化的“你现在是 VIP”邮件,并介绍专属福利
  3. 在 Shopify 上:使用 Shopify Flow(Plus)或标记应用自动为客户添加 vip 标签;使用该标签在店面展示 VIP 专属内容

自定义 / 无头架构

对于自行构建 CLV 计算的商店:

// lib/clv.ts

// Simple parametric CLV prediction — practical for most stores
export function calculatePredictedCLV(inputs: {
  avgOrderValue: number;
  avgOrderFrequencyPerYear: number;
  avgCustomerLifespanYears: number;
  grossMarginRate: number;
}): number {
  const { avgOrderValue, avgOrderFrequencyPerYear, avgCustomerLifespanYears, grossMarginRate } = inputs;
  return avgOrderValue * avgOrderFrequencyPerYear * avgCustomerLifespanYears * grossMarginRate;
}

// Per-customer prediction from their actual order history
export async function predictCustomerCLV(customerId: string, projectionYears = 2): Promise<number> {
  const orders = await db.orders.findMany({
    where: { customerId, status: { notIn: ['cancelled', 'refunded'] } },
    orderBy: { createdAt: 'asc' },
  });
  if (orders.length < 2) return 0;  // Not enough history

  const dates = orders.map(o => o.createdAt.getTime());
  const tenureDays = (dates[dates.length - 1] - dates[0]) / 86400000;
  const avgIntervalDays = tenureDays / (orders.length - 1);
  const purchasesPerYear = 365 / avgIntervalDays;
  const aov = orders.reduce((sum, o) => sum + o.subtotalCents / 100, 0) / orders.length;

  // Reduce projection for customers who haven't ordered recently
  const daysSinceLast = (Date.now() - dates[dates.length - 1]) / 86400000;
  const effectiveYears = daysSinceLast < 90 ? projectionYears : projectionYears * 0.5;

  return aov * purchasesPerYear * effectiveYears * 0.50;  // 50% gross margin
}

// Churn probability based on recency vs. typical purchase cadence
export async function calculateChurnProbability(customerId: string): Promise<number> {
  const orders = await db.orders.findMany({
    where: { customerId, status: { notIn: ['cancelled', 'refunded'] } },
    orderBy: { createdAt: 'desc' },
  });

  if (orders.length === 0) return 0.95;
  if (orders.length === 1) return 0.65;

  const daysSinceLast = (Date.now() - orders[0].createdAt.getTime()) / 86400000;
  const avgInterval = orders.slice(0, -1).reduce((sum, o, i) =>
    sum + (o.createdAt.getTime() - orders[i + 1].createdAt.getTime()) / 86400000, 0) / (orders.length - 1);

  // Sigmoid: churn probability rises as recency exceeds 2× typical interval
  const recencyRatio = daysSinceLast / avgInterval;
  return Math.min(0.99, Math.max(0.01, 1 / (1 + Math.exp(-2 * (recencyRatio - 2)))));
}

// Nightly job: update CLV scores and trigger win-back automation
export async function runChurnPreventionNightly() {
  const activeCustomers = await db.customers.findMany({ where: { orderCount: { gte: 2 } } });

  for (const customer of activeCustomers) {
    const [churnProbability, predictedCLV] = await Promise.all([
      calculateChurnProbability(customer.id),
      predictCustomerCLV(customer.id),
    ]);

    await db.customers.update({ where: { id: customer.id }, data: { churnProbability, predictedCLV } });

    // High-value, high-churn-risk: trigger win-back
    if (churnProbability > 0.70 && predictedCLV > 200) {
      const alreadyTriggered = await db.winBackTriggers.findFirst({
        where: { customerId: customer.id, createdAt: { gte: new Date(Date.now() - 90 * 86400000) } },
      });
      if (!alreadyTriggered) {
        await klaviyo.triggerFlow(customer.email, 'win-back-high-value');
        await db.winBackTriggers.create({ data: { customerId: customer.id } });
      }
    }
  }
}

对于拥有 10 万以上客户的商店: 使用 BG/NBD 概率模型(Python lifetimes 库),其预测准确度远高于参数方法:

from lifetimes import BetaGeoFitter, GammaGammaFitter
from lifetimes.utils import summary_data_from_transaction_data

# Build RFM summary and fit BG/NBD model
rfm = summary_data_from_transaction_data(orders_df, 'customer_id', 'created_at', 'subtotal_cents')
bgf = BetaGeoFitter(penalizer_coef=0.001)
bgf.fit(rfm['frequency'], rfm['recency'], rfm['T'])

ggf = GammaGammaFitter(penalizer_coef=0.001)
ggf.fit(rfm[rfm['frequency'] > 0]['frequency'], rfm[rfm['frequency'] > 0]['monetary_value'])

rfm['predicted_clv_12mo'] = ggf.customer_lifetime_value(bgf, rfm['frequency'], rfm['recency'], rfm['T'], rfm['monetary_value'], time=12, discount_rate=0.01)

最佳实践

  • 在构建自定义方案之前,先使用 Klaviyo 为 Shopify/WooCommerce 提供的预测 CLV——其模型经过良好校准,开箱即用
  • 至少每周更新一次 CLV 评分——客户行为会发生变化;过时的评分会导致留存营销活动的定向对象不准确
  • 在细分群组中区分预测 CLV 和历史消费额——两者回答的问题不同:历史消费额体现过去的价值,预测 CLV 则显示应当把投入放在哪里
  • 根据 CLV 为每个获客渠道设定 CAC 上限——如果来自 Google Ads 的客户平均 CLV 为 $80,利润率为 50%,那么可持续 CAC 上限为 $40
  • 根据实际结果校准流失概率——将 6 个月前的预测与实际流失客户进行比较;如果模型高估或低估流失概率,请调整阈值

常见问题

问题解决方案
少数几笔金额很大的订单拉高了 CLV 模型对参数模型使用订单金额中位数,而非平均 AOV;单笔离群订单会显著拉高平均值
客户只是去度假,挽回邮件却已触发触发挽回流程前,将“距上次购买的天数”最低阈值设为 60 天以上;较短的间隔很正常,并非流失信号
CLV 计算包含了已取消的订单始终过滤 status NOT IN ('cancelled', 'refunded')——已取消订单会高估收入
忠诚客户的预测 CLV 低于历史 CLV使用 BG/NBD 时,请确认任期变量 (T) 从首次购买日期起计算,而非从账户创建日期起计算

相关技能

  • @customer-segmentation
  • @referral-program
  • @personalization-engine

评论

支持 Markdown