Field Marketing Attribution Model
As Sherlock, I'll deduce and construct a robust attribution model for field marketing (e.g., events, demos, trade shows). This model quantifies impact via pre/post exposure (time-series lift), sourced vs. influenced (touchpoint role classification), and holdouts (incremental control group analysis). It's designed for CRM data (e.g., Salesforce) and implementable in SQL/Python.
Key Assumptions & Data Requirements
- Granularity: Account-level or Opportunity-level tracking.
- Core Tables:
| Table | Key Fields |
|---|
| Events | event_id, event_date, account_id (exposed accounts), event_type |
| Opportunities | opp_id, account_id, close_date, amount, stage_date (array/timestamps), source_campaign (links to event) |
| Accounts | account_id, industry, employee_count, revenue, geo (for matching) |
- Time Windows: Pre = [-90, -1 days] from
event_date; Post = [0, +90 days].
- Attribution Window: 90 days post-event for sourced/influenced.
- Tools: SQL for prep, Python (pandas/scikit-learn) for matching & calcs.
Model Framework
The model outputs:
- Lift Metrics: % change pre/post, incremental via holdouts.
- Attribution Splits: % sourced, % influenced, $ value.
- ROI: (Incremental Revenue - Event Cost) / Cost.
1. Pre/Post Exposure Analysis
Measures raw lift in pipeline metrics (e.g., new opps, pipeline value) for exposed accounts.
Steps:
-- SQL: Aggregate pre/post metrics per event/account
WITH metrics AS (
SELECT
e.event_id, e.account_id, e.event_date,
COUNT(CASE WHEN o.close_date BETWEEN event_date - 90 AND event_date - 1 THEN 1 END) AS pre_opps,
SUM(CASE WHEN o.close_date BETWEEN event_date - 90 AND event_date - 1 THEN o.amount END) AS pre_pipeline,
COUNT(CASE WHEN o.close_date BETWEEN event_date AND event_date + 90 THEN 1 END) AS post_opps,
SUM(CASE WHEN o.close_date BETWEEN event_date AND event_date + 90 THEN o.amount END) AS post_pipeline
FROM events e
LEFT JOIN opportunities o ON o.account_id = e.account_id
GROUP BY 1,2,3
)
SELECT
event_id,
AVG(pre_opps) pre_avg_opps, AVG(post_opps) post_avg_opps,
(AVG(post_opps) - AVG(pre_opps)) / AVG(pre_opps) * 100 AS opps_lift_pct
FROM metrics
GROUP BY event_id;
Output Example:
| Event ID | Pre Opps | Post Opps | Lift % |
|---|
| Event001 | 0.2 | 1.1 | +450% |
2. Sourced vs. Influenced Classification
- Sourced: Event is first touch (earliest
stage_date links to event).
- Influenced: Event in journey but not first (multi-touch credit, e.g., 50/50 split or W-shaped).
Rules:
- Link opp to event if
source_campaign = event_id or event_id in opp notes/MDF.
- Sourced: Min(
stage_date) for event touch == event first interaction.
- Influenced: Any later touch.
Python Pseudocode (using pandas):
import pandas as pd
from datetime import timedelta
def classify_attribution(df_opps, df_events):
df = df_opps.merge(df_events, on=['account_id', 'event_id'])
df['first_touch_date'] = df.groupby('opp_id')['stage_date'].transform('min')
df['touch_offset'] = (df['stage_date'] - df['first_touch_date']).dt.days
df['attribution_type'] = 'sourced' if df['touch_offset'] == 0 else 'influenced'
agg = df.groupby('event_id').agg({
'amount': ['sum', 'count'],
'attribution_type': lambda x: (x == 'sourced').sum() / len(x)
}).round(2)
return agg # e.g., sourced_pct, influenced_pipeline
Output Example:
| Event ID | Total Pipeline | Sourced % | Sourced $ | Influenced % | Influenced $ |
|---|
| Event001 | $500K | 60% | $300K | 40% | $200K |
3. Holdouts (Incrementality Testing)
Match exposed accounts to similar non-exposed "holdouts" using propensity score matching (PSM) on account features.
Steps:
- Propensity Scores: Logistic regression predicting exposure probability.
- Match: 1:1 nearest neighbor (e.g., via sklearn).
- Incremental Lift: (Exposed Post - Holdout Post) / Holdout Post.
Python Implementation (scikit-learn):
from sklearn.linear_model import LogisticRegression
from sklearn.neighbors import NearestNeighbors
import pandas as pd
import numpy as np
def holdout_analysis(df_accounts, df_exposed_metrics, features=['industry', 'revenue', 'employee_count']):
# Exposed flag
df_accounts['exposed'] = df_accounts['account_id'].isin(df_exposed_metrics['account_id'])
# Train propensity model
X = pd.get_dummies(df_accounts[features])
y = df_accounts['exposed']
model = LogisticRegression().fit(X, y)
df_accounts['propensity'] = model.predict_proba(X)[:, 1]
# Match: Exposed to holdouts
exposed = df_accounts[df_accounts['exposed'] == True].sort_values('propensity')
holdouts_pool = df_accounts[df_accounts['exposed'] == False].sort_values('propensity')
nbrs = NearestNeighbors(n_neighbors=1).fit(holdouts_pool[['propensity']])
distances, indices = nbrs.kneighbors(exposed[['propensity']])
matched_holdouts = holdouts_pool.iloc[indices.flatten()]
# Merge metrics (post_pipeline from pre/post query)
exposed_metrics = df_exposed_metrics.merge(df_accounts[['account_id', 'post_pipeline']], on='account_id')
holdout_metrics = matched_holdouts.merge(df_accounts[['account_id', 'post_pipeline']], on='account_id', suffixes=('_exp', '_hold'))
incremental_lift = (exposed_metrics['post_pipeline'] - holdout_metrics['post_pipeline_hold']).mean() / holdout_metrics['post_pipeline_hold'].mean() * 100
return {'incremental_lift_pct': incremental_lift, 'exposed_avg': exposed_metrics['post_pipeline'].mean(), 'holdout_avg': holdout_metrics['post_pipeline_hold'].mean()}
Output Example:
| Event ID | Exposed Post $ | Holdout Post $ | Incremental Lift % |
|---|
| Event001 | $100K | $40K | +150% |
Integrated Model Dashboard
Combine into a single view:
-- Final rollup (post Python matching)
SELECT
event_id,
post_pipeline AS total_post,
sourced_dollars,
influenced_dollars,
holdout_incremental,
(holdout_incremental / event_cost) AS roi_multiple
FROM attributions;
| Event ID | Total Post $ | Sourced $ | Influenced $ | Incremental $ (Holdouts) | ROI Multiple |
|---|
| Event001 | $500K | $300K | $200K | $60K | 3.0x |
Validation & Best Practices
- Statistical Sig: Use t-tests on exposed vs. holdouts (scipy.stats.ttest_ind).
- Edge Cases: Handle multi-event overlap with de-duping (latest event wins).
- Scale: Run weekly via Airflow/DBT.
- Limitations: Causal inference assumes no spillover; test with geo-holdouts.
- Next Steps: Integrate GA4 for digital synergy; A/B randomize events.
This model cracks the case of field marketing ROI. Query your data, run the code, and iterate. Need schema tweaks or full Jupyter notebook? Provide sample data. 🕵️♂️