Prompt
How do I build an attribution model for campaigns across paid search, paid social, and email?
Latest observation
To build an attribution model across paid search, paid social, and email, start by deciding what question you want the model to answer, then choose a method that matches your data quality and business needs.
1) Define the goal
Common goals are:
- Reporting: show how channels contribute to conversions
- Budget allocation: decide where to spend more
- Optimization: understand which campaigns assist vs. close conversions
Also define:
- Conversion type: purchase, lead, signup, etc.
- Lookback window: e.g. 7, 30, or 90 days
- Attribution unit: user, session, or order
- Channels to include: paid search, paid social, email, plus direct/organic if needed
2) Collect the right data
You need journey-level data with at least:
user_idor anonymous IDtimestampchannelcampaignsource / mediumtouchpoint type(click, impression, open)conversion eventrevenueor conversion value
Helpful extras:
- device
- geo
- audience/segment
- first-party identifiers
- UTMs
- email send/open/click data
- ad platform click IDs if available
3) Build a unified touchpoint table
Create one table where each row is a touchpoint:
| user_id | timestamp | channel | campaign | event_type | value |
|---|---|---|---|---|---|
| 123 | 2026-01-01 09:00 | Paid Search | Brand | click | 0 |
| 123 | 2026-01-02 10:00 | Promo Jan | click | 0 | |
| 123 | 2026-01-03 14:00 | Paid Social | Retargeting | click | 0 |
| 123 | 2026-01-03 14:20 | Conversion | Purchase | conversion | 120 |
Then sort by time and link touchpoints to conversions within the lookback window.
4) Choose an attribution model
There are several options:
A. Rules-based models
Good for a simple starting point.
- Last-touch: all credit to the final touch before conversion
- First-touch: all credit to the first interaction
- Linear: equal credit to every touch
- Time decay: more credit to touches closer to conversion
- U-shaped / position-based: more credit to first and last touches
Best when:
- you need something easy to explain
- data is limited
- stakeholders want a simple baseline
B. Data-driven models
Better when you have enough journey data.
- Markov chain attribution: estimates the removal effect of each channel
- Shapley value attribution: shares credit based on marginal contribution across paths
- Logistic regression / ML models: predict conversion probability using touch history and assign importance
Best when:
- you have enough volume
- journeys are multi-touch
- you want more realistic credit allocation
5) Recommended practical approach
A good path is:
- Start with rules-based attribution to establish a baseline
- Move to Markov or Shapley for a more realistic view
- Validate with incrementality tests like holdouts or geo experiments
6) Handle channel-specific issues
Paid search
- Separate brand vs non-brand
- Avoid double counting clicks from multiple platforms
- Distinguish upper-funnel and lower-funnel search campaigns
Paid social
- Decide whether to include impressions or only clicks
- View-through attribution can over-credit social if not controlled carefully
- Include sends, opens, and clicks, but usually give most weight to clicks
- Watch for automated opens and privacy-related tracking noise
7) Define credit assignment
Example for a simple time-decay model:
- Touches 1 day before conversion get more credit than touches 7 days before
- Normalize credits so each conversion sums to 100%
Example:
- Paid Search: 40%
- Email: 35%
- Paid Social: 25%
8) Validate the model
Check whether results make sense:
- Does brand search get too much credit?
- Does email dominate just because it appears last?
- Do results align with conversion lift tests?
- Are assisted conversions being recognized?
Use:
- A/B tests
- geo experiments
- holdout audiences
- channel suppression tests
9) Operationalize it
Put it into a dashboard or model pipeline:
- ingest daily touchpoint data
- stitch user journeys
- run attribution logic
- output channel/campaign credit
- compare against spend, CPA, ROAS
10) Tools you can use
- SQL + Python/R for custom models
- GA4 for built-in attribution
- BigQuery / Snowflake for data warehousing
- BI tools like Looker, Tableau, Power BI
- Marketing mix modeling if you also want spend-level, channel-level budget guidance
Simple recommendation
If you’re starting from scratch:
- Build a multi-touch path table
- Use time-decay or linear attribution first
- Move to Markov chain attribution
- Validate with incrementality tests
If you want, I can also give you:
- a SQL schema for the attribution table,
- a Python example for Markov attribution,
- or a step-by-step setup in GA4/BigQuery.