Agent skill

Campaign Analytics

by alirezarezvani in alirezarezvani/claude-skills

Calculates attribution, funnel and ROI figures for marketing campaigns with three Python scripts that need only the standard library.

MITAuto-check passedMarketing & SEO

Install Campaign Analytics

skills CLI
$ npx skills add alirezarezvani/claude-skills --skill campaign-analytics -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install alirezarezvani/claude-skills campaign-analytics --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/alirezarezvani/claude-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/marketing-skill/skills/campaign-analytics .claude/skills/campaign-analytics && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
campaign-analytics
GitHub stars
28k
Used in
1 other repo
Token cost
~2.1k tokens
SKILL.md length
654 words
Files
12 (incl. scripts, references, assets)
Skills in repo
342
Repo updated
First seen
Licence
MIT

At a glance

Calculates attribution, funnel and ROI figures for marketing campaigns with three Python scripts that need only the standard library.

  • Works in 3 steps: attribution_analyzer.py → funnel_analyzer.py → campaign_roi_calculator.py
  • Comparing channel contribution with multi-touch attribution models
  • SKILL.md covers Input Requirements, Output Formats, Typical Analysis Workflow and How to Use, plus 5 more sections
  • Runs Python scripts from its folder; calls python

What it does

The skill ships three command-line scripts: `attribution_analyzer.py`, `funnel_analyzer.py` and `campaign_roi_calculator.py`. Each reads a JSON file given as its first argument, with `assets/sample_campaign_data.json` showing the format, and prints a text report or JSON with `--format json`. The attribution script covers five models, time-decay among them, the funnel script reads stages and counts, and the ROI script works on a list of campaigns.

A typical review runs them in order: attribution to see which channels drive conversions, funnel analysis on those channels' segments, then ROI figures to guide budget reallocation. The scripts use only the Python standard library, with no API calls or ML models, and report bad input with descriptive errors, for example missing keys, funnel stage and count lists of different lengths, or non-numeric money values. Reference guides cover attribution models, benchmark metrics and funnel optimization, and templates cover campaign reports, channel comparisons and A/B tests.

When your agent uses it

  • Comparing channel contribution with multi-touch attribution models
  • Finding where prospects drop out of a conversion funnel
  • Calculating ROI, ROAS or CPA across campaigns
  • Preparing a campaign report or channel comparison

Example prompts

  • “Run the attribution analyzer on campaign_data.json with the time-decay model.”
  • “Analyze the funnel in funnel_data.json and tell me which stage loses the most people.”
  • “Calculate ROI for each campaign in our Q3 export and rank them.”
  • “Compare the paid search and email channels and write the report with the channel comparison template.”

Requirements

  • Python (standard library only)

Workflow steps

3 steps, taken from the step headings in SKILL.md.

  1. attribution_analyzer.py
  2. funnel_analyzer.py
  3. campaign_roi_calculator.py

What it can do on your machine

Read from SKILL.md and the folder at commit 19392f7. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 3 files in scripts/ (Python), which the agent can run.

    Shell commands in SKILL.md call:

    • python

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Campaign Analytics loads about 2.1k tokens when it runs, and up to ~9.5k if it reads all its reference files. Until then it costs about 82 tokens; SKILL.md has 654 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~82
When it runs · the whole SKILL.md, loaded when a task matches
~2.1k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~9.5k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from alirezarezvani/claude-skills at commit 19392f7, republished under its MIT licence (© alirezarezvani). 654 words, ~2,099 tokens.

Download SKILL.mdSave it as .claude/skills/campaign-analytics/SKILL.md (or your agent's skills folder). This skill also uses 11 other files; get the full folder from GitHub.
name
campaign-analytics
description
Analyzes campaign performance with multi-touch attribution, funnel conversion analysis, and ROI calculation for marketing optimization. Use when analyzing marketing campaigns, ad performance, attribution models, conversion rates, or calculating marketing ROI, ROAS, CPA, and campaign metrics across channels.
license
MIT
metadata.version
1.0.0
metadata.author
Alireza Rezvani
metadata.category
marketing
metadata.domain
campaign-analytics
metadata.updated
2026-02-06
metadata.python-tools
attribution_analyzer.py, funnel_analyzer.py, campaign_roi_calculator.py
metadata.tech-stack
marketing-analytics, attribution-modeling

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
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
    }
  ]
}
Funnel Analyzer
json
{
  "funnel": {
    "stages": ["Awareness", "Interest", "Consideration", "Intent", "Purchase"],
    "counts": [10000, 5200, 2800, 1400, 420]
  }
}
Campaign ROI Calculator
json
{
  "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:

bash
# 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
bash
# 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
bash
# 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
bash
# 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:

ModelDescriptionBest For
First-Touch100% credit to first interactionBrand awareness campaigns
Last-Touch100% credit to last interactionDirect response campaigns
LinearEqual credit to all touchpointsBalanced multi-channel evaluation
Time-DecayMore credit to recent touchpointsShort sales cycles
Position-Based40/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

GuideLocationPurpose
Attribution Models Guidereferences/attribution-models-guide.mdDeep dive into 5 models with formulas, pros/cons, selection criteria
Campaign Metrics Benchmarksreferences/campaign-metrics-benchmarks.mdIndustry benchmarks by channel and vertical for CTR, CPC, CPM, CPA, ROAS
Funnel Optimization Frameworkreferences/funnel-optimization-framework.mdStage-by-stage optimization strategies, common bottlenecks, best practices

Show full SKILL.md (257 more words)Show less

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.
  • 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.

© alirezarezvani, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 11 other files (scripts, references, assets) in marketing-skill/skills/campaign-analytics of alirezarezvani/claude-skills.

  • SKILL.md
  • assets/ab_test_template.md
  • assets/campaign_report_template.md
  • assets/channel_comparison_template.md
  • assets/expected_output.json
  • assets/sample_campaign_data.json
  • references/attribution-models-guide.md
  • references/campaign-metrics-benchmarks.md
  • references/funnel-optimization-framework.md
  • scripts/attribution_analyzer.py
  • scripts/campaign_roi_calculator.py
  • scripts/funnel_analyzer.py

Open the folder on GitHubat commit 19392f7

Used in 1 other repository

We found 1 copy of this SKILL.md (exact, near-identical or edited) in other folders, from 1 other GitHub owner. This page covers the copy in alirezarezvani/claude-skills, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Campaign Analytics next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Campaign Analytics compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Campaign Analytics this skillalirezarezvani/claude-skills28k1 repos~2.1kAutomated safety check: PassMIT
Meridian Budget Optimizationgoogle/meridian1.6k—~1.1kAutomated safety check: PassApache-2.0
Google Ads Managementivangfalco/ads-skills278—~2.1kAutomated safety check: NotesCustom licence
Meta Ads AuditAgriciDaniel/claude-ads9.8k—~906Automated safety check: PassMIT
Meta Pixel Setupooiyeefei/ccc494—~2.4kAutomated safety check: PassMIT
Google AdsaAAaqwq/AGI-Super-Team1051 repos~1.4kAutomated safety check: PassMIT

Similar skills

  • Official

    Reopens a fitted Meridian MMM from a saved file and runs budget allocation scenarios, producing an HTML report and a Python script that repeats the run.

    1.6k GitHub stars~1.1k tokensUpdated today
    Marketing & SEOAuto-check passed
  • Google Ads Management

    ivangfalco/ads-skills

    Manages Google Ads accounts with Python scripts for the Google Ads API, backed by an intent-first B2B strategy knowledge base.

    278 GitHub stars~2.1k tokensUpdated 2 mo ago
    Marketing & SEOAuto-check: notes
  • Meta Ads Audit

    AgriciDaniel/claude-ads

    Audits a Meta Ads account across Pixel and Conversions API, attribution, creative, audiences, placements, budgets and policy, and reports evidence-backed findings.

    9.8k GitHub stars~906 tokensUpdated yesterday
    Marketing & SEOAuto-check passed
  • Meta Pixel Setup

    ooiyeefei/ccc

    Walks a site owner through installing the Meta Pixel, firing one conversion event and verifying it with the Pixel Helper before any ads run.

    494 GitHub stars~2.4k tokensUpdated 2 mo ago
    Marketing & SEOAuto-check passed
  • Google Ads

    aAAaqwq/AGI-Super-Team

    Query, audit, and optimize Google Ads campaigns. An agent skill from aAAaqwq/AGI-Super-Team.

    105 GitHub starsUsed in 1 repo~1.4k tokens
    Marketing & SEOAuto-check passed
  • Paid Ads Audit

    AgriciDaniel/claude-ads

    Runs a source-grounded paid advertising audit across up to 12 ad platforms, with parallel platform workers, deterministic scoring and a versioned JSON bundle.

    9.8k GitHub stars~1.5k tokensUpdated yesterday
    Marketing & SEOAuto-check passed

More from alirezarezvani/claude-skills

All 342 skills in this repo
  • Agile Product Owner

    alirezarezvani/claude-skills

    Writes INVEST-checked user stories with acceptance criteria, splits epics, plans sprints from velocity and ranks the backlog with a weighted score.

    28k GitHub starsUsed in 3 repos~3.2k tokens
    Auto-check passed
  • Product Strategist

    alirezarezvani/claude-skills

    OKR cascade toolkit for product leaders: generates aligned company-to-team OKRs from five strategy types and scores how well they line up.

    28k GitHub starsUsed in 2 repos~1.8k tokens
    Auto-check passed
  • App Store Optimization

    alirezarezvani/claude-skills

    App Store Optimization (ASO) toolkit for researching keywords, analyzing competitor rankings, generating metadata suggestions, and improving app visibility on Apple App Store and Google Play Store.

    28k GitHub starsUsed in 1 repo~4.2k tokens
    Auto-check passed
  • AWS Solution Architect

    alirezarezvani/claude-skills

    Design AWS architectures for startups using serverless patterns and IaC templates.

    28k GitHub starsUsed in 1 repo~2.5k tokens
    Auto-check passed
  • Code to PRD

    alirezarezvani/claude-skills

    Reverse-engineers a frontend, backend or fullstack codebase into a product requirements document with per-page docs, an enum dictionary and an API inventory.

    28k GitHub starsUsed in 1 repo~4.9k tokens
    Auto-check passed
  • Customer Success Manager

    alirezarezvani/claude-skills

    Scores customer health, churn risk and expansion potential from a JSON export of account data, using three Python scripts that need no extra libraries.

    28k GitHub starsUsed in 1 repo~2.3k tokens
    Auto-check passed

Works with

Categories

Questions about Campaign Analytics

What does Campaign Analytics do?

Calculates attribution, funnel and ROI figures for marketing campaigns with three Python scripts that need only the standard library. py`.json` showing the format, and prints a text report or JSON with `--format json`.

When should I use Campaign Analytics?

Campaign Analytics fits situations like: comparing channel contribution with multi-touch attribution models; finding where prospects drop out of a conversion funnel; calculating ROI, ROAS or CPA across campaigns; preparing a campaign report or channel comparison.

How do I install Campaign Analytics in Claude Code?

Run `npx skills add alirezarezvani/claude-skills --skill campaign-analytics -a claude-code`. Or copy the skill folder (marketing-skill/skills/campaign-analytics in alirezarezvani/claude-skills) into .claude/skills/campaign-analytics in your project. Claude Code loads it when a task matches its description.

How do I install Campaign Analytics in Codex?

Run `npx skills add alirezarezvani/claude-skills --skill campaign-analytics -a codex`. Or copy the skill folder (marketing-skill/skills/campaign-analytics in alirezarezvani/claude-skills) into .agents/skills/campaign-analytics in your project. Codex loads it when a task matches its description.

Can I use Campaign Analytics in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add alirezarezvani/claude-skills --skill campaign-analytics -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/campaign-analytics, .gemini/skills/campaign-analytics, .github/skills/campaign-analytics and .opencode/skills/campaign-analytics in your project.

What does Campaign Analytics need to run?

Going by SKILL.md and its folder, Campaign Analytics needs Python for the scripts in its folder and the command-line tools its instructions call (python). Our summary lists: Python (standard library only).

Does Campaign Analytics access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Campaign Analytics safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Campaign Analytics use?

Campaign Analytics is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Campaign Analytics use?

About 2.1k tokens (SKILL.md is roughly 8.4k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 7.4k tokens, read only when the agent opens those files.

What are the alternatives to Campaign Analytics?

Skills that share tags, products or a category with Campaign Analytics: Meridian Budget Optimization (google/meridian, 1.6k stars), Google Ads Management (ivangfalco/ads-skills, 278 stars), Meta Ads Audit (AgriciDaniel/claude-ads, 9.8k stars) and Meta Pixel Setup (ooiyeefei/ccc, 494 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Campaign Analytics?

alirezarezvani (a GitHub user) maintains it in alirezarezvani/claude-skills, which has 27,829 GitHub stars. The repository holds 342 skills in this directory. The repository was last updated on August 30, 2026.

Source: alirezarezvani/claude-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.