campaign-analytics by alirezarezvani/claude-skills
npx skills add https://github.com/alirezarezvani/claude-skills --skill campaign-analytics具备生产级的多触点归因建模、漏斗转化分析和投资回报率计算功能。三个 Python CLI 工具仅使用标准库提供确定性、可重复的分析——无需外部依赖、无需 API 调用、无需机器学习模型。
所有脚本都接受一个 JSON 文件作为位置输入参数。完整示例请参见 assets/sample_campaign_data.json。
{
"journeys": [
{
"journey_id": "j1",
"touchpoints": [
{"channel": "organic_search", "timestamp": "2025-10-01T10:00:00", "interaction": "click"},
{"channel": "email", "timestamp": "2025-10-05T14:30:00", "interaction": "open"},
{"channel": "paid_search", "timestamp": "2025-10-08T09:15:00", "interaction": "click"}
],
"converted": true,
"revenue": 500.00
}
]
}
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
{
"funnel": {
"stages": ["Awareness", "Interest", "Consideration", "Intent", "Purchase"],
"counts": [10000, 5200, 2800, 1400, 420]
}
}
{
"campaigns": [
{
"name": "Spring Email Campaign",
"channel": "email",
"spend": 5000.00,
"revenue": 25000.00,
"impressions": 50000,
"clicks": 2500,
"leads": 300,
"customers": 45
}
]
}
所有脚本都通过 --format 标志支持两种输出格式:
--format text(默认):便于人工审阅的可读性强的表格和摘要--format json:便于集成和流水线处理的机器可读 JSON# 运行全部 5 种归因模型
python scripts/attribution_analyzer.py campaign_data.json
# 运行特定模型
python scripts/attribution_analyzer.py campaign_data.json --model time-decay
# 用于流水线集成的 JSON 输出
python scripts/attribution_analyzer.py campaign_data.json --format json
# 自定义时间衰减半衰期(默认:7 天)
python scripts/attribution_analyzer.py campaign_data.json --model time-decay --half-life 14
# 基础漏斗分析
python scripts/funnel_analyzer.py funnel_data.json
# JSON 输出
python scripts/funnel_analyzer.py funnel_data.json --format json
# 计算所有活动的投资回报率指标
python scripts/campaign_roi_calculator.py campaign_data.json
# JSON 输出
python scripts/campaign_roi_calculator.py campaign_data.json --format json
实现五种行业标准归因模型,用于在营销渠道间分配转化功劳:
| 模型 | 描述 | 最佳适用场景 |
|---|---|---|
| 首次触点 | 100% 功劳归于首次互动 | 品牌知名度活动 |
| 末次触点 | 100% 功劳归于末次互动 | 直接响应活动 |
| 线性 | 所有触点平均分配功劳 | 平衡的多渠道评估 |
| 时间衰减 | 近期触点获得更多功劳 | 短销售周期 |
| 基于位置 | 40/20/40 分配(首次/中间/末次) | 全漏斗营销 |
分析转化漏斗以识别瓶颈和优化机会:
计算全面的投资回报率指标,附带行业基准:
| 指南 | 位置 | 用途 |
|---|---|---|
| 归因模型指南 | references/attribution-models-guide.md | 深入探讨 5 种模型,包含公式、优缺点、选择标准 |
| 活动指标基准 | references/campaign-metrics-benchmarks.md | 按渠道和垂直行业划分的点击率、每次点击成本、每千次展示成本、每次获取成本、广告支出回报率等行业基准 |
| 漏斗优化框架 | references/funnel-optimization-framework.md | 分阶段优化策略、常见瓶颈、最佳实践 |
每周安装量
95
代码仓库
GitHub 星标数
4.1K
首次出现
2026年2月6日
安全审计
安装于
claude-code82
gemini-cli76
codex74
opencode73
cursor70
github-copilot69
Production-grade campaign performance analysis with multi-touch attribution modeling, funnel conversion analysis, and ROI calculation. Three Python CLI tools provide deterministic, repeatable analytics using standard library only -- no external dependencies, no API calls, no ML models.
All scripts accept a JSON file as positional input argument. See assets/sample_campaign_data.json for complete examples.
{
"journeys": [
{
"journey_id": "j1",
"touchpoints": [
{"channel": "organic_search", "timestamp": "2025-10-01T10:00:00", "interaction": "click"},
{"channel": "email", "timestamp": "2025-10-05T14:30:00", "interaction": "open"},
{"channel": "paid_search", "timestamp": "2025-10-08T09:15:00", "interaction": "click"}
],
"converted": true,
"revenue": 500.00
}
]
}
{
"funnel": {
"stages": ["Awareness", "Interest", "Consideration", "Intent", "Purchase"],
"counts": [10000, 5200, 2800, 1400, 420]
}
}
{
"campaigns": [
{
"name": "Spring Email Campaign",
"channel": "email",
"spend": 5000.00,
"revenue": 25000.00,
"impressions": 50000,
"clicks": 2500,
"leads": 300,
"customers": 45
}
]
}
All scripts support two output formats via the --format flag:
--format text (default): Human-readable tables and summaries for review--format json: Machine-readable JSON for integrations and pipelines# Run all 5 attribution models
python scripts/attribution_analyzer.py campaign_data.json
# Run a specific model
python scripts/attribution_analyzer.py campaign_data.json --model time-decay
# JSON output for pipeline integration
python scripts/attribution_analyzer.py campaign_data.json --format json
# Custom time-decay half-life (default: 7 days)
python scripts/attribution_analyzer.py campaign_data.json --model time-decay --half-life 14
# Basic funnel analysis
python scripts/funnel_analyzer.py funnel_data.json
# JSON output
python scripts/funnel_analyzer.py funnel_data.json --format json
# Calculate ROI metrics for all campaigns
python scripts/campaign_roi_calculator.py campaign_data.json
# JSON output
python scripts/campaign_roi_calculator.py campaign_data.json --format json
Implements five industry-standard attribution models to allocate conversion credit across marketing channels:
| Model | Description | Best For |
|---|---|---|
| First-Touch | 100% credit to first interaction | Brand awareness campaigns |
| Last-Touch | 100% credit to last interaction | Direct response campaigns |
| Linear | Equal credit to all touchpoints | Balanced multi-channel evaluation |
| Time-Decay | More credit to recent touchpoints | Short sales cycles |
| Position-Based | 40/20/40 split (first/middle/last) | Full-funnel marketing |
Analyzes conversion funnels to identify bottlenecks and optimization opportunities:
Calculates comprehensive ROI metrics with industry benchmarking:
| Guide | Location | Purpose |
|---|---|---|
| Attribution Models Guide | references/attribution-models-guide.md | Deep dive into 5 models with formulas, pros/cons, selection criteria |
| Campaign Metrics Benchmarks | references/campaign-metrics-benchmarks.md | Industry benchmarks by channel and vertical for CTR, CPC, CPM, CPA, ROAS |
| Funnel Optimization Framework | references/funnel-optimization-framework.md | Stage-by-stage optimization strategies, common bottlenecks, best practices |
Weekly Installs
95
Repository
GitHub Stars
4.1K
First Seen
Feb 6, 2026
Security Audits
Gen Agent Trust HubWarnSocketPassSnykPass
Installed on
claude-code82
gemini-cli76
codex74
opencode73
cursor70
github-copilot69
DOCX文件创建、编辑与分析完整指南 - 使用docx-js、Pandoc和Python脚本
51,800 周安装