重要前提
安装AI Skills的关键前提是:必须科学上网,且开启TUN模式,这一点至关重要,直接决定安装能否顺利完成,在此郑重提醒三遍:科学上网,科学上网,科学上网。查看完整安装教程 →
campaign-analytics by borghei/claude-skills
npx skills add https://github.com/borghei/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 | 分阶段优化策略、常见瓶颈、最佳实践 |
要进行完整的营销活动审查,请按顺序运行三个脚本:
# 步骤 1 -- 归因:了解哪些渠道驱动转化
python scripts/attribution_analyzer.py campaign_data.json --model time-decay
# 步骤 2 -- 漏斗:识别潜在客户在转化路径上的流失点
python scripts/funnel_analyzer.py funnel_data.json
# 步骤 3 -- 投资回报率:计算盈利能力并与行业标准对比
python scripts/campaign_roi_calculator.py campaign_data.json
使用归因结果识别表现最佳的渠道,然后专注于这些渠道细分的漏斗分析,最后验证投资回报率指标以优先考虑预算重新分配。
运行脚本前,请验证您的 JSON 是否有效且符合预期模式。常见错误:
journeys、funnel.stages、campaigns)——脚本以描述性 KeyError 退出stages 和 counts 长度必须相同)——引发 ValueErrorTypeError在将任何文件传递给脚本之前,使用 python -m json.tool your_file.json 来验证 JSON 语法。
每周安装量
41
代码库
GitHub 星标数
29
首次出现
2026 年 2 月 23 日
安全审计
安装于
claude-code34
opencode27
gemini-cli27
github-copilot27
cline27
codex27
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 |
For a complete campaign review, run the three scripts in sequence:
# Step 1 -- Attribution: understand which channels drive conversions
python scripts/attribution_analyzer.py campaign_data.json --model time-decay
# Step 2 -- Funnel: identify where prospects drop off on the path to conversion
python scripts/funnel_analyzer.py funnel_data.json
# Step 3 -- ROI: calculate profitability and benchmark against industry standards
python scripts/campaign_roi_calculator.py campaign_data.json
Use attribution results to identify top-performing channels, then focus funnel analysis on those channels' segments, and finally validate ROI metrics to prioritize budget reallocation.
Before running scripts, verify your JSON is valid and matches the expected schema. Common errors:
journeys, funnel.stages, campaigns) -- script exits with a descriptive KeyErrorstages and counts must be the same length) -- raises ValueErrorTypeErrorUse python -m json.tool your_file.json to validate JSON syntax before passing it to any script.
Weekly Installs
41
Repository
GitHub Stars
29
First Seen
Feb 23, 2026
Security Audits
Gen Agent Trust HubPassSocketFailSnykPass
Installed on
claude-code34
opencode27
gemini-cli27
github-copilot27
cline27
codex27
前端代码审计工具 - 自动化检测可访问性、性能、响应式设计、主题化与反模式
57,700 周安装