← 返回 Skills 市场
alirezarezvani

Campaign Analytics

作者 Alireza Rezvani · GitHub ↗ · v2.1.1 · MIT-0
cross-platform ✓ 安全检测通过
408
总下载
0
收藏
6
当前安装
2
版本数
在 OpenClaw 中安装
/install campaign-analytics
功能描述
Analyzes campaign performance with multi-touch attribution, funnel conversion analysis, and ROI calculation for marketing optimization. Use when analyzing ma...
使用说明 (SKILL.md)

Campaign Analytics

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.


Input Requirements

All scripts accept a JSON file as positional input argument. See assets/sample_campaign_data.json for complete examples.

Attribution Analyzer

{
  "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 Analyzer

{
  "funnel": {
    "stages": ["Awareness", "Interest", "Consideration", "Intent", "Purchase"],
    "counts": [10000, 5200, 2800, 1400, 420]
  }
}

Campaign ROI Calculator

{
  "campaigns": [
    {
      "name": "Spring Email Campaign",
      "channel": "email",
      "spend": 5000.00,
      "revenue": 25000.00,
      "impressions": 50000,
      "clicks": 2500,
      "leads": 300,
      "customers": 45
    }
  ]
}

Input Validation

Before running scripts, verify your JSON is valid and matches the expected schema. Common errors:

  • Missing required keys (e.g., journeys, funnel.stages, campaigns) → script exits with a descriptive KeyError
  • Mismatched array lengths in funnel data (stages and counts must be the same length) → raises ValueError
  • Non-numeric monetary values in ROI data → raises TypeError

Use python -m json.tool your_file.json to validate JSON syntax before passing it to any script.


Output Formats

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

Typical Analysis Workflow

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.


How to Use

Attribution Analysis

# 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

Funnel Analysis

# Basic funnel analysis
python scripts/funnel_analyzer.py funnel_data.json

# JSON output
python scripts/funnel_analyzer.py funnel_data.json --format json

Campaign ROI Calculation

# 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

Scripts

1. attribution_analyzer.py

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

2. funnel_analyzer.py

Analyzes conversion funnels to identify bottlenecks and optimization opportunities:

  • Stage-to-stage conversion rates and drop-off percentages
  • Automatic bottleneck identification (largest absolute and relative drops)
  • Overall funnel conversion rate
  • Segment comparison when multiple segments are provided

3. campaign_roi_calculator.py

Calculates comprehensive ROI metrics with industry benchmarking:

  • ROI: Return on investment percentage
  • ROAS: Return on ad spend ratio
  • CPA: Cost per acquisition
  • CPL: Cost per lead
  • CAC: Customer acquisition cost
  • CTR: Click-through rate
  • CVR: Conversion rate (leads to customers)
  • Flags underperforming campaigns against industry benchmarks

Reference Guides

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

Best Practices

  1. Use multiple attribution models -- Compare at least 3 models to triangulate channel value; no single model tells the full story.
  2. Set appropriate lookback windows -- Match your time-decay half-life to your average sales cycle length.
  3. Segment your funnels -- Compare segments (channel, cohort, geography) to identify performance drivers.
  4. Benchmark against your own history first -- Industry benchmarks provide context, but historical data is the most relevant comparison.
  5. Run ROI analysis at regular intervals -- Weekly for active campaigns, monthly for strategic review.
  6. Include all costs -- Factor in creative, tooling, and labor costs alongside media spend for accurate ROI.
  7. Document A/B tests rigorously -- Use the provided template to ensure statistical validity and clear decision criteria.

Limitations

  • No statistical significance testing -- Scripts provide descriptive metrics only; p-value calculations require external tools.
  • Standard library only -- No advanced statistical libraries. Suitable for most campaign sizes but not optimized for datasets exceeding 100K journeys.
  • Offline analysis -- Scripts analyze static JSON snapshots; no real-time data connections or API integrations.
  • Single-currency -- All monetary values assumed to be in the same currency; no currency conversion support.
  • Simplified time-decay -- Exponential decay based on configurable half-life; does not account for weekday/weekend or seasonal patterns.
  • No cross-device tracking -- Attribution operates on provided journey data as-is; cross-device identity resolution must be handled upstream.

Related Skills

  • analytics-tracking: For setting up tracking. NOT for analyzing data (that's this skill).
  • ab-test-setup: For designing experiments to test what analytics reveals.
  • marketing-ops: For routing insights to the right execution skill.
  • paid-ads: For optimizing ad spend based on analytics findings.
安全使用建议
This appears to be a locally-run analytics toolkit. Before installing or running: (1) review the full source of all three scripts (campaign_roi_calculator.py and funnel_analyzer.py were truncated in the package preview) to confirm there are indeed no network calls or hidden behavior; (2) run the tools on synthetic or non-sensitive sample data first; (3) avoid feeding production PII/credentials into the sample JSON unless you’ve inspected the code; (4) run in an isolated environment or container if you want extra safety. If you need help auditing the two remaining scripts for network calls or file-system access, share their sources and I can review them.
功能分析
Type: OpenClaw Skill Name: campaign-analytics Version: 2.1.1 The campaign-analytics skill bundle is a well-documented toolkit for marketing performance analysis. The Python scripts (attribution_analyzer.py, campaign_roi_calculator.py, and funnel_analyzer.py) use only the Python standard library, perform deterministic mathematical calculations on provided JSON data, and contain no network calls, shell execution, or sensitive data access. The SKILL.md instructions are strictly aligned with the stated purpose and do not contain any prompt injection attempts or malicious directives.
能力评估
Purpose & Capability
Name/description, SKILL.md, templates, reference docs, sample data, and the three Python scripts all align on performing attribution, funnel, and ROI analysis. Nothing in the manifest or instructions requests unrelated resources or credentials.
Instruction Scope
SKILL.md instructs running local Python CLI scripts against user-supplied JSON and describes input/output formats; it does not ask the agent to read unrelated system files, access environment credentials, or send data externally. The shown script (attribution_analyzer.py) operates only on the input JSON and uses the standard library.
Install Mechanism
No install spec is provided (instruction+scripts only). That is proportionate for a small CLI toolkit and limits the skill from pulling arbitrary remote code during install.
Credentials
The skill declares no required environment variables, no primary credential, and no config paths. The SKILL.md and visible script do not reference secrets or external APIs, so requested environment access is minimal and appropriate.
Persistence & Privilege
always is false (no forced presence). The skill is user-invocable and can be called autonomously (platform default), which is expected for a utility. It does not request system-wide configuration changes or modify other skills.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install campaign-analytics
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /campaign-analytics 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v2.1.1
v2.1.1: optimization, reference splits
v1.0.0
v2.1.1 release
元数据
Slug campaign-analytics
版本 2.1.1
许可证 MIT-0
累计安装 6
当前安装数 6
历史版本数 2
常见问题

Campaign Analytics 是什么?

Analyzes campaign performance with multi-touch attribution, funnel conversion analysis, and ROI calculation for marketing optimization. Use when analyzing ma... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 408 次。

如何安装 Campaign Analytics?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install campaign-analytics」即可一键安装,无需额外配置。

Campaign Analytics 是免费的吗?

是的,Campaign Analytics 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Campaign Analytics 支持哪些平台?

Campaign Analytics 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Campaign Analytics?

由 Alireza Rezvani(@alirezarezvani)开发并维护,当前版本 v2.1.1。

💬 留言讨论