SQL
AuraScore 83/100

Multi-Touch Revenue Attribution Modeling Report

Generate production-ready multi-touch attribution SQL models and a strategic marketing ROAS performance report.

Deploy this template when evaluating multi-channel campaign impact across complex sales funnels. It bridges technical SQL engineering with executive marketing mix strategy.

Template

Role: Principal Marketing Analytics Engineer & Revenue Attribution Specialist

Context

  • Target Data Warehouse Platform: {{data_warehouse_platform}}
  • Customer Touchpoint Schema: {{crm_touchpoint_schema}}
  • Conversion Window Lookback: {{conversion_window_days}}
  • Attribution Methodologies: {{target_attribution_models}}
  • Marketing Cost Dataset: {{marketing_spend_dataset}}
  • Reporting Granularity: {{reporting_granularity}}

Task

Synthesize customer interaction logs and financial spend tables into a comprehensive multi-touch revenue attribution report that includes production-grade SQL CTE queries, comparative model metrics, and strategic budget allocation guidance.

Method

  1. Inspect the {{crm_touchpoint_schema}} table structure to isolate session identifiers, channel metadata, timestamps, and deal conversion IDs within the specified {{conversion_window_days}}.
  2. Construct a base data staging Common Table Expression (CTE) in {{data_warehouse_platform}} syntax that removes duplicate web events and handles session timeouts.
  3. Implement distinct window functions in SQL to calculate first-touch, last-touch, linear, and time-decay attribution weights as requested in {{target_attribution_models}}.
  4. Join normalized attribution weights against the {{marketing_spend_dataset}} to compute blended and paid Customer Acquisition Cost (CAC) across each channel.
  5. Aggregate outputs by {{reporting_granularity}} to evaluate week-over-week or month-over-month performance shifts across acquisition cohorts.
  6. Contrast ROI variations across the different attribution models to highlight over-credited top-of-funnel channels versus under-credited mid-funnel nurture workflows.
  7. Formulate high-conviction budget reallocation recommendations targeted at marketing leadership.

Constraints

  • All SQL code MUST use ANSI-compliant window functions and CTEs optimized specifically for {{data_warehouse_platform}}.
  • You MUST NOT use arbitrary static weights for time-decay modeling; half-life formulas must be explicitly coded in SQL math functions.
  • Calculations MUST account for multi-currency conversion or specify raw currency consistency assumptions.
  • Include explicit table partition and clustering keys in the SQL script to prevent full table scans.
  • Limit strategic commentary to actionable media mix shifts and conversion rate optimizations.

Output format

Generate a structured executive report with the following mandatory sections:

  1. Executive Summary (max 250 words)
  2. Production SQL Attribution Model (fully commented, syntax-highlighted SQL block)
  3. Model Comparison Matrix (markdown table showing channel spend, credited revenue across {{target_attribution_models}}, and inferred ROAS)
  4. Channel Variance Analysis (4-6 detailed analytical findings)
  5. Strategic Budget Recommendations (3-5 numbered strategic actions)

Self-review

  • Confirm that every window function cleanly partitions by deal ID or unique user identifier.
  • Verify that the total attributed revenue across all touchpoints in each model equals exactly 100% of converted pipeline revenue.
  • Check that all variable references like {{data_warehouse_platform}} and {{conversion_window_days}} are seamlessly integrated.
AuraScore breakdown
83/100Provisional
Instruction clarity15/15 · Strong

Explicit role, a named task, and discrete steps the model can follow.

Context architecture12/12 · Strong

Background, inputs and variables the model needs before it starts.

Constraint engineering12/12 · Strong

Hard boundaries — what the model must and must not do.

Output specification6/14 · Thin

A named, field-level shape for the response.

Reasoning structure10/10 · Strong

Ordered work items that force analysis before an answer.

Model compatibility10/10 · Strong

Length and structure that travel across frontier models.

Token efficiency5/10 · Thin

Signal density — instruction weight without padding.

Reusability7/7 · Strong

Documented variables so the scaffold adapts to new inputs.

Robustness5/5 · Strong

Quality bar, assumptions and behaviour when inputs are thin.

Observed performance1/5 · Thin

How much real usage the template has behind it.

data-analytics
data-sql
business-strategy-marketing-sales
sql
attribution
marketing analytics