Skip to content

Analytics

Marketing metrics, attribution models, and performance dashboards

Overview

Unified analytics platform providing full-funnel visibility from marketing touchpoints through revenue attribution. Combines campaign performance, lead intelligence, and sales pipeline data for data-driven decision making.

Structure

13-analytics/
├── attribution/          # Attribution models and reports
├── dashboards/           # Dashboard configurations
├── reports/              # Scheduled report templates
├── metrics/              # KPI definitions and calculations
└── integrations/         # Analytics tool integrations

Subdirectories

attribution/

Multi-touch attribution models and configuration.

Attribution Models: | Model | Description | Best For | |-------|-------------|----------| | First Touch | 100% credit to first interaction | Brand awareness campaigns | | Last Touch | 100% credit to last interaction | Conversion-focused analysis | | Linear | Equal credit across all touchpoints | Balanced view | | Time Decay | More credit to recent touches | Long sales cycles | | Position Based | 40% first/last, 20% middle | B2B with clear entry/exit | | Data-Driven | ML-weighted attribution | Large datasets (1000+ conversions) |

Key Documents: - attribution-models.md — Model definitions and use cases - channel-mapping.md — UTM and channel classification - conversion-definitions.md — What counts as a conversion

dashboards/

Dashboard configurations for different audiences.

Available Dashboards: | Dashboard | Audience | Key Metrics | |-----------|----------|-------------| | Executive | Leadership | Pipeline, revenue, ROI | | Marketing Ops | Marketing team | MQLs, CPL, conversion rates | | Campaign Manager | Campaign owners | Campaign performance, engagement | | Sales | Sales team | Lead volume, quality scores | | Content | Content team | Asset performance, engagement |

reports/

Automated report templates and schedules.

Standard Reports: | Report | Frequency | Distribution | |--------|-----------|--------------| | Weekly Marketing Summary | Weekly (Mon) | Marketing team | | Campaign Performance | Weekly (Fri) | Campaign owners | | Pipeline Attribution | Weekly | Sales + Marketing | | Monthly Business Review | Monthly | Leadership | | Quarterly Deep Dive | Quarterly | All stakeholders |

metrics/

KPI definitions and calculation methodologies.

Core Metrics: | Metric | Calculation | Target | |--------|-------------|--------| | MQL Conversion Rate | MQLs / Total Leads | 15-25% | | SQL Conversion Rate | SQLs / MQLs | 20-30% | | Cost Per Lead (CPL) | Spend / Leads | Varies by channel | | Customer Acquisition Cost (CAC) | Total Sales+Mktg / New Customers | <⅓ LTV | | Marketing Sourced Pipeline | Pipeline from marketing leads | 50%+ | | Marketing Influenced Revenue | Revenue where marketing touched | 70%+ |

integrations/

Analytics platform integrations and data flows.

Integrated Platforms: - Google Analytics 4: Web behavior, conversion tracking - HubSpot/Salesforce: CRM data, deal attribution - LinkedIn Ads: Campaign performance, leads - Google Ads: Search/display performance - Mixpanel/Amplitude: Product analytics

Analytics Architecture

┌─────────────────────────────────────────────────────────────────────────────┐
│                          ANALYTICS PLATFORM                                  │
├─────────────────────────────────────────────────────────────────────────────┤
│                                                                              │
│  ┌─────────────────────────────────────────────────────────────────────┐   │
│  │ DATA COLLECTION LAYER                                                │   │
│  │ ─────────────────────                                                │   │
│  │ Web Analytics │ CRM Data │ Ad Platforms │ Intent Signals │ Sales   │   │
│  └─────────────────────────────────────────────────────────────────────┘   │
│                                    │                                        │
│                                    ▼                                        │
│  ┌─────────────────────────────────────────────────────────────────────┐   │
│  │ DATA UNIFICATION LAYER                                               │   │
│  │ ──────────────────────                                               │   │
│  │ Identity Resolution │ Channel Mapping │ Event Standardization       │   │
│  └─────────────────────────────────────────────────────────────────────┘   │
│                                    │                                        │
│                                    ▼                                        │
│  ┌─────────────────────────────────────────────────────────────────────┐   │
│  │ ATTRIBUTION ENGINE                                                   │   │
│  │ ──────────────────                                                   │   │
│  │ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐                 │   │
│  │ │ Multi-Touch  │ │   Revenue    │ │   Channel    │                 │   │
│  │ │ Attribution  │ │  Attribution │ │ Performance  │                 │   │
│  │ └──────────────┘ └──────────────┘ └──────────────┘                 │   │
│  └─────────────────────────────────────────────────────────────────────┘   │
│                                    │                                        │
│                                    ▼                                        │
│  ┌─────────────────────────────────────────────────────────────────────┐   │
│  │ VISUALIZATION & REPORTING                                            │   │
│  │ ─────────────────────────                                            │   │
│  │ Real-Time Dashboards │ Scheduled Reports │ Ad-Hoc Analysis          │   │
│  └─────────────────────────────────────────────────────────────────────┘   │
│                                                                              │
└─────────────────────────────────────────────────────────────────────────────┘

Analytics Metrics

Metric Target Frequency
Data Freshness <15 min delay Real-time
Attribution Accuracy 95%+ Monthly validation
Dashboard Load Time <3 seconds Per load
Report Delivery 99%+ on schedule Weekly
Data Coverage 100% touchpoints Continuous

Skills Integration

Primary Skill: Campaign Orchestration

The campaign-orchestration skill provides unified analytics and attribution capabilities.

Invoke: Load when building attribution models, campaign analytics, or performance dashboards.

Key Subskills: - @unified-analytics.md — Cross-channel data aggregation and normalization - @attribution-modeling.md — Multi-touch attribution model implementation - @real-time-dashboard.md — Live metrics and monitoring visualizations - @alert-engine.md — Anomaly detection and threshold alerting

Secondary Skill: Lead Intelligence

The lead-intelligence skill provides funnel analytics and lead-level attribution.

Invoke: Load when analyzing lead quality, funnel conversion, or cohort performance.

Key Subskills: - @funnel-analytics.md — Full-funnel conversion reporting - @cohort-analysis.md — Lead cohort behavior tracking - @attribution-reporting.md — Lead-level source attribution - @predictive-analytics.md — Conversion forecasting models

SDK Integration

from campaign_orchestration import CampaignManager, AttributionEngine
from lead_intelligence import LeadIntelligence, FunnelAnalytics
from sbp.sdk.orchestration import DurableContext, durable_handler

# Initialize analytics components
campaigns = CampaignManager()
attribution = AttributionEngine(
    models=["first_touch", "last_touch", "linear", "data_driven"],
    conversion_window_days=90
)
funnel = FunnelAnalytics()
leads = LeadIntelligence()

# Generate attribution report
async def generate_attribution_report(date_range: DateRange):
    """Generate comprehensive attribution report."""

    # Get campaign performance data
    campaign_metrics = await campaigns.get_metrics(date_range)

    # Calculate multi-touch attribution
    attribution_data = await attribution.calculate(
        touchpoints=await campaigns.get_touchpoints(date_range),
        conversions=await leads.get_conversions(date_range),
        model="data_driven"
    )

    # Funnel analytics
    funnel_metrics = await funnel.analyze(
        stages=["known", "engaged", "mql", "sql", "opportunity", "customer"],
        date_range=date_range
    )

    return {
        "campaigns": campaign_metrics,
        "attribution": attribution_data,
        "funnel": funnel_metrics,
        "roi_by_channel": attribution_data.roi_by_channel,
        "conversion_rates": funnel_metrics.stage_conversions
    }

# Real-time dashboard data feed
async def dashboard_metrics_stream(refresh_interval: int = 30):
    """Stream real-time metrics for dashboard."""
    while True:
        yield {
            "leads_today": await leads.count(period="today"),
            "mqls_today": await leads.count(stage="mql", period="today"),
            "active_campaigns": await campaigns.count(status="active"),
            "spend_mtd": await campaigns.total_spend(period="mtd"),
            "pipeline_mtd": await leads.pipeline_value(period="mtd"),
            "top_channels": await attribution.top_channels(limit=5),
            "hot_leads": await leads.query(
                filters={"scores.composite": {"$gte": 80}},
                limit=10
            )
        }
        await asyncio.sleep(refresh_interval)

# Cohort analysis for lead quality
async def analyze_lead_cohorts(cohort_definition: dict):
    """Analyze lead cohorts by source, time period, or campaign."""

    cohorts = await leads.create_cohorts(
        dimension=cohort_definition["dimension"],  # "source", "campaign", "month"
        date_range=cohort_definition["date_range"]
    )

    analysis = []
    for cohort in cohorts:
        analysis.append({
            "cohort_name": cohort.name,
            "lead_count": cohort.count,
            "mql_rate": cohort.stage_conversion("mql"),
            "sql_rate": cohort.stage_conversion("sql"),
            "avg_deal_size": cohort.avg_deal_size,
            "avg_sales_cycle": cohort.avg_sales_cycle_days,
            "ltv": cohort.customer_ltv
        })

    return analysis

# Predictive analytics
async def forecast_pipeline(months_ahead: int = 3):
    """Forecast pipeline based on historical conversion rates."""

    historical = await funnel.get_historical_data(months=12)
    current_pipeline = await leads.pipeline_by_stage()

    forecast = await leads.forecast(
        current_state=current_pipeline,
        historical_rates=historical.conversion_rates,
        months=months_ahead
    )

    return {
        "current_pipeline": current_pipeline.total_value,
        "forecasted_revenue": forecast.expected_revenue,
        "confidence_interval": forecast.confidence_interval,
        "assumptions": forecast.assumptions
    }

Subskills Reference

Subskill Skill Purpose
@unified-analytics.md CO Cross-channel data aggregation
@attribution-modeling.md CO Multi-touch attribution
@real-time-dashboard.md CO Live monitoring dashboards
@alert-engine.md CO Anomaly detection, alerts
@funnel-analytics.md LI Full-funnel conversion
@cohort-analysis.md LI Lead cohort behavior
@attribution-reporting.md LI Lead-level attribution
@predictive-analytics.md LI Conversion forecasting