ingest: support-analytics-reporter.md

- Source page: Analytics Reporter Agent Personality
- Concepts: RFM-Analysis, Marketing-Attribution
- Updated: index.md (entry fix), overview.md (Support dept), log.md
This commit is contained in:
2026-04-25 21:06:28 +08:00
parent c304b2b2e2
commit 82741b1c69
6 changed files with 267 additions and 3 deletions

View File

@@ -0,0 +1,102 @@
---
title: "Marketing Attribution"
type: concept
tags: []
sources: [support-analytics-reporter]
last_updated: 2026-04-21
---
## Aliases
- 营销归因模型
- Multi-Touch Attribution多触点归因
- Attribution Modeling
## Definition
Marketing Attribution营销归因是一种数据分析方法用于将客户的转化收入或转化行为按照用户旅程中各触点渠道/广告位/活动)的贡献权重进行分配,从而量化不同营销渠道的真实价值,指导预算优化和 ROI 最大化。
## Attribution Models
### 1. Single-Touch单触点归因
| 模型 | 归因逻辑 | 优点 | 缺点 |
|------|---------|------|------|
| First Touch | 100% 归因给首个触点 | 识别获客渠道 | 忽视转化路径上的其他渠道 |
| Last Touch | 100% 归因给末触点 | 识别转化触点 | 忽视品牌建设类触点 |
### 2. Multi-Touch多触点归因
| 模型 | 归因逻辑 | 适用场景 |
|------|---------|---------|
| Linear | 平均分配权重 | 各触点均等重要 |
| Time Decay | 越接近转化时间权重越高 | 短转化周期B2C电商 |
| Position Based (U-Shaped) | 首+末各 40%,中间均分剩余 20% | 品牌+效果兼顾 |
| Data-Driven | 基于 Shapley 值或机器学习模型 | 有足够转化数据支撑 |
### 3. Algorithmic Attribution算法归因
基于 Shapley 值(博弈论)或 logistic 回归/马尔可夫链模型,从数据中自动学习各触点权重,是最精确但数据需求量最大的方案。
## Multi-Touch Attribution Implementation
```sql
-- Multi-touch attribution with first/last/intermediate weights
WITH customer_touchpoints AS (
SELECT
customer_id,
channel,
campaign,
touchpoint_date,
conversion_date,
revenue,
ROW_NUMBER() OVER (PARTITION BY customer_id ORDER BY touchpoint_date) as touch_sequence,
COUNT(*) OVER (PARTITION BY customer_id) as total_touches
FROM marketing_touchpoints mt
JOIN conversions c ON mt.customer_id = c.customer_id
WHERE touchpoint_date <= conversion_date
),
attribution_weights AS (
SELECT *,
CASE
WHEN touch_sequence = 1 AND total_touches = 1 THEN 1.0 -- Single touch
WHEN touch_sequence = 1 THEN 0.4 -- First touch
WHEN touch_sequence = total_touches THEN 0.4 -- Last touch
ELSE 0.2 / (total_touches - 2) -- Middle touches
END as attribution_weight
FROM customer_touchpoints
)
SELECT
channel,
campaign,
SUM(revenue * attribution_weight) as attributed_revenue,
COUNT(DISTINCT customer_id) as attributed_conversions
FROM attribution_weights
GROUP BY channel, campaign
ORDER BY attributed_revenue DESC;
```
## Campaign ROI Calculation
```sql
SELECT
campaign_name,
SUM(spend) as total_spend,
SUM(attributed_revenue) as total_revenue,
(SUM(attributed_revenue) - SUM(spend)) / SUM(spend) * 100 as roi_percentage,
SUM(attributed_revenue) / SUM(spend) as revenue_multiple,
COUNT(conversions) as total_conversions,
SUM(spend) / COUNT(conversions) as cost_per_conversion
FROM campaign_performance
GROUP BY campaign_name
ORDER BY roi_percentage DESC;
```
## Key Metrics
| 指标 | 公式 | 业务含义 |
|------|------|---------|
| ROI | (归因收入 - 花费) / 花费 × 100% | 渠道盈利性 |
| ROAS | 归因收入 / 广告花费 | 广告效率 |
| CPA | 总花费 / 归因转化数 | 获客成本 |
| Revenue Multiple | 归因收入 / 花费 | 收入倍数 |
## Connections
- [[support-analytics-reporter]] — 使用多触点归因模型进行营销效果分析
- [[Marketing-ROI]] — 归因分析是 ROI 计算的基础
- [[Business-Intelligence]] — 属 BI 领域的营销分析子方向

View File

@@ -0,0 +1,79 @@
---
title: "RFM Analysis"
type: concept
tags: []
sources: [support-analytics-reporter]
last_updated: 2026-04-21
---
## Aliases
- RFM Segmentation
- Recency, Frequency, Monetary Analysis
- 客户价值分层分析
## Definition
RFM Analysis 是一种三维客户价值分层方法通过最近购买时间Recency、购买频率Frequency、消费金额Monetary三个维度对客户进行分群从而识别高价值客户、流失风险客户和潜力客户为精准营销和客户运营提供数据支撑。
## Core Metrics
| 维度 | 定义 | 计算方式 |
|------|------|----------|
| Recency | 最近一次购买距今天数 | `当前日期 - 最近购买日期`(越小越好) |
| Frequency | 购买总次数 | `COUNT(order_id)`(越大越好) |
| Monetary | 累计消费金额 | `SUM(revenue)`(越大越好) |
## Scoring Method
每个维度按分位数通常5分位打分
- R_Score最近购买时间越近分数越高1-5分5=最近)
- F_Score购买频率越高分数越高1-5分5=最频繁)
- M_Score消费金额越高分数越高1-5分5=最高金额)
组合 R+F+M 得 RFM Score`555``311`)。
## Customer Segments
| RFM Score | 客户类型 | 策略建议 |
|-----------|---------|---------|
| 555/554/544/545/454/455/445 | Champions冠军客户 | 奖励忠诚度,邀请推荐,升级销售高端产品 |
| 543/444/435/355/354/345/344/335 | Loyal Customers忠诚客户 | 培养关系,推荐新品,忠诚度计划 |
| 553/551/552/541/542/533/532/531/452/451 | Potential Loyalists潜力忠诚者 | 入会欢迎,早期参与,产品教育 |
| 512/511/422/421/412/411/311 | New Customers新客户 | 入职优化,早期参与 |
| 155/154/144/214/215/115/114 | At Risk流失风险客户 | 重新参与活动,特殊优惠,赢回策略 |
| 其他 | Others一般客户 | 常规触达,持续观察 |
## Implementation
```python
import pandas as pd
import numpy as np
def rfm_analysis(df, current_date=None):
"""RFM Analysis implementation"""
if current_date is None:
current_date = df['date'].max()
rfm = df.groupby('customer_id').agg({
'date': lambda x: (current_date - x.max()).days, # Recency
'order_id': 'count', # Frequency
'revenue': 'sum' # Monetary
}).rename(columns={
'date': 'recency',
'order_id': 'frequency',
'revenue': 'monetary'
})
# Create quintile scores (1-5)
rfm['r_score'] = pd.qcut(rfm['recency'], 5, labels=[5,4,3,2,1], duplicates='drop')
rfm['f_score'] = pd.qcut(rfm['frequency'].rank(method='first'), 5, labels=[1,2,3,4,5], duplicates='drop')
rfm['m_score'] = pd.qcut(rfm['monetary'], 5, labels=[1,2,3,4,5], duplicates='drop')
rfm['rfm_score'] = rfm['r_score'].astype(str) + rfm['f_score'].astype(str) + rfm['m_score'].astype(str)
return rfm
```
## Connections
- [[support-analytics-reporter]] — 使用 RFM 进行客户价值分层分析
- [[Customer-Segmentation]] — RFM 是客户细分的核心方法之一
- [[Business-Intelligence]] — 属 BI 领域的客户分析子方向