A runnable report desk built on marketing_campaigns â website_visitors â conversions. Every metric is computed by an executed aggregation â no hard-coded numbers. Date-window, attribution model and source filters re-execute all four queries and every chart, KPI and export below.
marketing_campaigns â website_visitors â conversions · GROUP BY mc.campaign_id
website_visitors â conversions · CASE WHEN pivot · GROUP BY source
DATE_FORMAT(session_start,'%Y-%m') · COUNT(DISTINCT â¦) · Q3b self-join on visitor_id
INNER JOIN conversions ON conversion_type = 'purchase' · GROUP BY wv.source
The dataset is generated once from a fixed PRNG seed, then every number on this page is produced by the aggregations shown above. Re-running with a different date window re-executes all five result sets.
website_visitors holds one row per session, so visitor_id repeats.
Every COUNT(DISTINCT visitor_id) is therefore meaningful and SUM(c.value) over a
raw join is not â conversions are pre-aggregated to visitor grain before the campaign join.
A visitor with n in-window sessions would join each conversion n times. Revenue is computed over distinct conversion_id; the inflated literal figure is reported in each module's caveat strip so the difference is auditable.
Date window (as specified): any visitor with a session inside
BETWEEN start_date AND end_date. Strict UTM adds
AND wv.utm_campaign = mc.campaign_id. The ROI inflation factor between the two is displayed live.
budget_spent accrues linearly across the flight; a selected window is
charged budget à overlap_days / flight_days. Full-flight budget appears in tooltips.
conversions.value is signed: refund rows carry negative value and
reduce net revenue (Q1/KPIs). Q4 filters conversion_type='purchase', so its AOV is gross of refunds.
All timestamps are local, truncated to session start. Queries run against
pre-built hash indexes (byDay, byVisitor, convByVisitor) â typical full-suite
execution is well under 20 ms for ~14k joined rows.