From agi-super-team
Analyzes campaign performance with multi-touch attribution, funnel conversion analysis, and ROI calculation for marketing optimization.
How this skill is triggered — by the user, by Claude, or both
Slash command
/agi-super-team:campaign-analyticsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
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.
assets/ab_test_template.mdassets/campaign_report_template.mdassets/channel_comparison_template.mdassets/expected_output.jsonassets/sample_campaign_data.jsonreferences/attribution-models-guide.mdreferences/campaign-metrics-benchmarks.mdreferences/funnel-optimization-framework.mdscripts/attribution_analyzer.pyscripts/campaign_roi_calculator.pyscripts/funnel_analyzer.pyProduction-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.
| Problem | Likely Cause | Solution |
|---|---|---|
| Attribution model shows all credit on one channel | Using first-touch or last-touch on a multi-channel funnel | Switch to linear, time-decay, or position-based attribution. Compare at least 3 models to triangulate true channel value. GA4's data-driven attribution (DDA) is the recommended default for 2026 |
| Funnel conversion rate is unrealistically high or low | Mismatched stage definitions or counts array length error | Verify that stages and counts arrays are the same length and ordered top-to-bottom (largest count first). Ensure counts represent unique users at each stage, not cumulative events |
| ROI calculator flags all campaigns as underperforming | Channel name in JSON does not match built-in benchmark keys | Use exact channel names: email, paid_search, paid_social, display, organic_search, organic_social, referral, direct. Unrecognized channels fall back to default benchmarks |
| Time-decay model produces unexpected credit distribution | Half-life parameter does not match your sales cycle | Set --half-life to approximately half your average sales cycle length. For B2B SaaS (60-90 day cycles), use --half-life 30. For e-commerce (1-7 day cycles), use --half-life 3 |
| JSON parsing errors on script execution | Malformed JSON, trailing commas, or encoding issues | Validate JSON with python -m json.tool your_file.json before passing to any script. Ensure UTF-8 encoding and no BOM characters |
| GA4 attribution data does not match script output | Different lookback windows and model defaults | GA4 uses a 30-day lookback for acquisition and 90-day for engagement by default. DDA falls back to last-click when a key event has fewer than 400 conversions. Align your script's --half-life and data window to match GA4 settings |
| Campaign spend data shows zero ROI despite conversions | Revenue field missing or set to zero in input JSON | Ensure every campaign object includes a revenue field with actual attributed revenue. If revenue attribution is not available, use estimated values based on average deal size multiplied by customer count |
In Scope:
Out of Scope:
| Integration | Purpose | How to Connect |
|---|---|---|
| Google Analytics 4 (GA4) | Source of journey and conversion data | Export GA4 Exploration reports or use BigQuery export to generate journey JSON. GA4's DDA model (default in 2026) complements this skill's 5 models. Align lookback windows: GA4 defaults to 30-day acquisition / 90-day engagement |
| HubSpot | CRM attribution, lead scoring, deal data | Export HubSpot contact journey data with UTM parameters as JSON input. Use W-shaped (40-20-40) attribution for hybrid PLG/sales motions. Map HubSpot lifecycle stages to funnel analyzer stages |
| UTM Parameter Standards | Consistent campaign tagging | Enforce lowercase UTM values: utm_source={channel}, utm_medium={type}, utm_campaign={campaign-id}, utm_content={variant}, utm_term={keyword}. GA4 treats Email and email as separate entries |
| social-media-analyzer skill | Social channel performance data | Feed social media campaign metrics from calculate_metrics.py into campaign_roi_calculator.py for cross-channel ROI comparison |
| marketing-demand-acquisition skill | Demand gen campaign planning | Use attribution results to identify top-performing channels, then feed insights into demand gen budget allocation decisions |
| Business intelligence tools (Looker, Tableau, Power BI) | Dashboard visualization | Use --format json output from all three scripts for direct ingestion into BI tools. JSON output is structured for easy transformation |
| Spreadsheet tools (Excel, Google Sheets) | Manual analysis and reporting | Use --format text output for human-readable reports. Copy JSON output into spreadsheets for custom pivot analysis |
Type: CLI script with argparse
Usage:
python attribution_analyzer.py <input_file> [--model MODEL] [--half-life DAYS] [--format FORMAT]
| Flag | Required | Default | Description |
|---|---|---|---|
input_file | Yes | -- | Path to JSON file containing journey/touchpoint data. Must have a top-level journeys array |
--model | No | all 5 models | Run a specific model: first-touch, last-touch, linear, time-decay, position-based |
--half-life | No | 7.0 | Half-life in days for time-decay model. Set to ~half your average sales cycle |
--format | No | text | Output format: text (human-readable tables) or json (machine-readable) |
Input Schema: {"journeys": [{"journey_id": "str", "touchpoints": [{"channel": "str", "timestamp": "ISO-8601", "interaction": "str"}], "converted": bool, "revenue": float}]}
Output: Summary statistics (total journeys, conversion rate, total revenue, channels observed) plus per-model channel credit allocation with revenue and share percentages. Cross-model comparison table when running all models.
Type: CLI script with argparse
Usage:
python funnel_analyzer.py <input_file> [--format FORMAT]
| Flag | Required | Default | Description |
|---|---|---|---|
input_file | Yes | -- | Path to JSON file containing funnel data. Must have funnel (single) or segments (multi-segment) key |
--format | No | text | Output format: text or json |
Single Funnel Input: {"funnel": {"stages": ["Stage1", "Stage2", ...], "counts": [10000, 5200, ...]}}
Multi-Segment Input: {"stages": ["Stage1", "Stage2", ...], "segments": {"segment_a": {"counts": [...]}, "segment_b": {"counts": [...]}}}
Output: Stage-by-stage conversion rates, drop-off counts and percentages, cumulative conversion, bottleneck identification (both absolute and relative), and segment rankings when comparing multiple segments.
Type: CLI script with argparse
Usage:
python campaign_roi_calculator.py <input_file> [--format FORMAT]
| Flag | Required | Default | Description |
|---|---|---|---|
input_file | Yes | -- | Path to JSON file containing campaign data. Must have a top-level campaigns array |
--format | No | text | Output format: text or json |
Input Schema: {"campaigns": [{"name": "str", "channel": "str", "spend": float, "revenue": float, "impressions": int, "clicks": int, "leads": int, "customers": int}]}
Recognized Channels for Benchmarking: email, paid_search, paid_social, display, organic_search, organic_social, referral, direct. Unrecognized channels use default benchmarks.
Calculated Metrics: ROI %, ROAS, CPA, CPL, CAC, CTR %, CVR % (lead-to-customer), CPC, CPM, click-to-lead rate %, profit. Each campaign assessed against channel-specific benchmarks (low/target/high) with performance flags and recommendations.
Output: Portfolio summary (totals, blended metrics, top performer, flagged campaigns, channel breakdown) plus per-campaign detail with benchmark assessments, warning flags, and actionable recommendations.
npx claudepluginhub aaaaqwq/agi-super-team --plugin agi-super-teamAnalyzes marketing performance via attribution models, ROI/CAC/LTV metrics, tracking setup, campaign reports, and dashboards for data-driven decisions.
Guides selection and implementation of marketing attribution models (last-click, linear, data-driven, MMM) to allocate conversion credit across touchpoints and improve budget allocation.