Why Build a Custom Media Mix Model?
Click-based attribution in GA4 undervalues anything that influences a purchase without getting the last click. Paid social, display, video, and SEO all look worse than they are, and branded paid search looks better than it is. Media mix modeling (MMM) gets around that by measuring the relationship between spend and revenue over time, with no cookies or tagging involved. I covered the case for it in Can Media Mix Modeling Be Used for Measuring SEO Value?
Google Meridian and Meta’s Robyn are both excellent open-source MMM libraries. The fact is that both are code libraries, and the person defending a marketing budget to a CFO is rarely the person who wants to tune a sampler in a notebook. I built this tool on the same principles as Meridian (Bayesian regression, adstock, saturation, credible intervals) rather than on top of it, with a UI that takes a CSV in and puts decisions out.
The other reason is SEO. Most MMMs treat organic search as noise in the baseline. This model lets organic sessions, email sessions, or content output sit in the model as control variables and show up in the attribution, which is the only way I’ve found to put a defensible number on SEO’s contribution next to paid media.
What Data Does a Media Mix Model Need?
One CSV, one row per week (or per day). The validator checks it before any modeling happens.
| Input | What it needs | Notes |
|---|---|---|
| Date | Weekly or daily periods, no duplicates. | 52 periods minimum. 104 (two years) is the realistic floor for separating seasonality from media effects. |
| KPI | Revenue or leads. | ROI is reported as revenue per dollar or leads per dollar to match. |
| Media spend | One column per channel. | Paid search, paid social, display, video, affiliate, email, TV, radio, out-of-home, direct mail, or anything else with a spend line. |
| Controls | Anything else that moves the KPI. | SEO sessions, promotions, pricing, macro events. Each gets an expected direction (positive, negative, unknown) and a prior strength. |
Validation flags the usual problems before they become bad estimates: duplicate or unparseable dates, negative spend, channels that are all zeros, too many missing values, and spend columns that are highly correlated with a control variable (the classic multicollinearity trap where two channels always move together and the model can’t tell them apart).
How Does the Media Mix Model Work?
The model is a Bayesian regression that explains each period’s KPI as baseline demand plus the transformed effect of every media channel. Five pieces do the work.
1. Adstock: Media Spend Has a Memory
Advertising keeps working after the week it runs. Geometric adstock carries a share of each week’s spend into the following weeks, with a decay rate and maximum lag per channel. TV and video carry over for weeks. Paid search and affiliate barely carry over at all. Each channel type starts from a sensible preset that the analyst can adjust.
2. Saturation: Diminishing Returns on Media Spend
The tenth thousand dollars in a channel doesn’t buy what the first thousand did. A Hill saturation curve bends each channel’s response, and the half-saturation point (where the channel is delivering half its maximum effect) is learned from the data rather than assumed.
3. Baseline: Sales That Would Have Happened Anyway
Intercept, linear trend, Fourier seasonality terms, and the control variables together model the revenue that shows up regardless of media. Getting the baseline right matters more than anything else. An underfit baseline hands seasonal demand to whichever channel happened to spend during peak season.
4. Bayesian Priors: What We Believe Before Seeing the Data
Media effects are constrained to be non-negative, since a channel can be useless but it shouldn’t mathematically destroy revenue. Control variables get priors that match their expected direction and strength. Priors are scaled to the KPI so the same configuration works for a business doing $40K a week or $4M.
5. Fit, Validate, and Diagnose the Model
PyMC samples the posterior with NUTS across multiple chains. The most recent weeks are held out so the model gets judged on data it never saw, with R² on the training window and MAPE on the holdout. Convergence diagnostics (R-hat and effective sample size from ArviZ) have to pass before any of the numbers get trusted. A model that hasn’t converged produces confident-looking garbage.
What Does the Model Report?
Channel contribution and ROI with credible intervals
Every channel’s contribution and ROI is computed across the full posterior, then reported as a mean with a 95% credible interval. A channel with an ROI of 2.4 and an interval of 1.9 to 2.9 is a different conversation than one at 2.4 with an interval of 0.3 to 4.8. The width of the interval is the most honest thing an MMM can tell you.
Organic search and email in the attribution
Organic search sessions and email sessions sit in the model as control variables marked for attribution, so they show up in the waterfall next to the paid channels instead of disappearing into the baseline. On the tool’s synthetic sample data, Organic Search accounts for $9.3M (28% of revenue), more than any paid channel. A separate SEO Performance view goes a level deeper, adding the lagged effects of content output, technical SEO improvements, and link building on top of organic traffic.
Marginal ROI by channel
Average ROI says how a channel performed. Marginal ROI says what the next dollar is worth at current spend. A channel can have a great average and a poor margin when it’s already deep into saturation, and that’s exactly where budget gets wasted. The tool turns the two numbers into a plain recommendation per channel: scale up, cut, optimize, or reallocate.
Channel response curves
Each channel’s spend-to-revenue curve, plotted from zero to well past the highest spend level in the data. These are the charts that end up in the CFO deck because they make diminishing returns obvious without any statistics.
Media budget optimizer
Given a total budget (current or new), a constrained optimizer (SciPy SLSQP) finds the channel split that maximizes total response. Per-channel minimums and maximums keep the answer realistic, because nobody is going to cut TV to zero or triple paid social in a quarter regardless of what the math says. It also scans budget levels to find where the marginal return on total spend drops below break-even.
Media budget scenario planning
What-if sliders for each channel, quick scenarios like “all channels +10%”, and single-channel sensitivity sweeps. Useful for the questions that come up in planning meetings before anyone has decided on a budget.
Incrementality testing toolkit
MMM is a model, and models should be checked against experiments. The toolkit covers geo-lift analysis with a synthetic control, holdout test evaluation against what the model predicted, and power analysis so a test is sized to detect the effect before it runs. When a lift test and the MMM disagree, the experiment wins.
What Can’t Media Mix Modeling Tell You?
- It’s a national model, not a geo-hierarchical one. Meridian can pool information across regions. This model works on one aggregate time series.
- Adstock settings are set by the analyst, not learned. Decay and lag come from channel presets and judgment. That means the credible intervals don’t include uncertainty about carryover, so they’re somewhat narrower than the truth.
- Optimizer and scenario outputs are point estimates. Contribution and ROI carry full intervals. The planning tools run on the posterior means.
- Lift test results inform the model by hand. They aren’t yet fed back into the priors automatically.
- It can’t fix thin data. If a channel’s spend barely varies over two years, no model can estimate its effect. The intervals will say so.
When Does Media Mix Modeling Make Sense?
- When the budget is being defended to finance. “GA4 says so” doesn’t survive a CFO. A model with stated assumptions and credible intervals does.
- When channel mix is changing. Before shifting spend from paid search to paid social (or the reverse), the response curves show where each channel sits on its saturation curve.
- When SEO’s value is being questioned. Executives generally assume they’d get the organic traffic anyway. Putting organic sessions in the model next to paid media is the closest thing to an answer.
- When click attribution has broken down. Cookie restrictions, consent banners, and AI search referrals that show up as direct traffic all erode last-click data. MMM doesn’t use clicks.
Working With Me on Media Mix Modeling
The Media Mix Modeling tool runs on client engagements as part of my consulting work. Most of the effort is upstream of the model: pulling spend from ad platforms, reconciling it with revenue, deciding which controls belong in the model, and then explaining the output to people who don’t want to hear about posterior distributions. If you want to know what your channels are actually doing, feel free to reach out.