Marketing mix modeling, step by step: from data to budget
Export two years of weekly sales from Shopify and weekly spend from each ad platform. Add promotions and holidays, and check you have enough rows per variable. Fit Robyn or Meridian, calibrate it with a test, then move budget using ROI, marginal ROI and response curves.
By Joris van Huët, Founder & CEOUpdated 7 min read
Run the numbers for your store: the free multi-channel budget calculator.
To run marketing mix modeling, you usually start with two years of weekly sales from Shopify and weekly spend from each ad platform. Add promotions, price changes and holidays. Fit an open-source model such as Meta's Robyn or Google's Meridian. Check it against a holdout test, then shift budget where the next euro still pays.
Step by step
Eleven steps, in the order the work happens. Robyn's guide calls data collection the most time-consuming part, so expect most of your hours to go before step 9.
- Write down the one budget question the model must answer. Robyn's guide lists the questions a mix model answers best. Two of them: how should budget be split by channel, and where should the next marketing dollar go? Pick one, because it decides what data you collect. Path: Robyn docs, An Analyst's Guide to MMM, Collecting your measurement business questions.
- Export weekly sales from Shopify. From your Shopify admin, go to Analytics > Reports and open Total sales over time. In the configuration panel's Dimensions menu, pick week as the time unit, then export the report as a CSV. Path: Analytics > Reports > Total sales over time > Dimensions > Export.
- Export weekly spend from Google Ads. Open the Campaigns table, select the segment icon and choose Time, then Week. Ask for a long date range and Google may tell you to download a report instead. Path: Campaigns > segment icon > Time > Week.
- Repeat for every paid channel, with exposure. Meridian needs spend for each paid channel plus one exposure metric, such as impressions, clicks or spend. Robyn's guide prefers impressions and warns against clicks, which miss people who saw an ad and bought later. Path: the same Google Ads table, with Impr. next to Cost.
- List what else moved sales. Promotions, price changes, launches and holidays get their own columns. Robyn calls them context variables, and Meridian calls them controls and non-media treatments. Newsletters and organic posts go in as organic media, since they have no direct cost. Path: Robyn docs, Key Features; Meridian docs, Collect and organize your data.
- Fill the gaps. Meridian requires a complete dataset with no missing values. A week when a channel was paused is a zero, not a blank. Path: Meridian docs, Collect and organize your data, Data imputation.
- Count rows per variable. Robyn's guide recommends a ratio of 1 independent variable to 10 observations. With weekly data, more channels means more years of history. Path: Robyn docs, An Analyst's Guide to MMM, Data sparsity.
- Review the data before you fit anything. Chart weekly sales next to each channel's spend, and look for channels that always move together. Robyn's guide warns that highly correlated inputs make it hard for a regression to separate their effects. Path: Robyn docs, An Analyst's Guide to MMM, Data Review.
- Fit the model. In Robyn,
robyn_inputs()takes your data androbyn_run()fits candidate models, then you pick one from the Pareto-optimal set. Meridian splits the same job into pre-modeling, modeling and post-modeling. Path: Robyn docs, Key Features; Meridian docs, An introduction to Meridian. - Calibrate it with a test. Robyn's guide strongly recommends calibrating with experiments, such as conversion lift or geo-based incrementality studies. Robyn takes the result as a calibration input, and Meridian can take experiments as priors. Path: Robyn docs, Modeling Phase, Model Calibration.
- Read the outputs, then move budget. Meridian's guide says to use ROI for past performance, response curves for future budgets and marginal ROI for saturation. Robyn's
robyn_allocator()then suggests a budget mix for a total you set. Path: Meridian docs, Post-modeling, ROI, mROI and response curves.
A worked example
Start with one store's export: Store A, 1 January 2024 to 21 August 2026. It holds shares of revenue only and no spend column, so steps 3 and 4 must come from the ad accounts, not from this file. Skip those pulls and no amount of modeling fixes the missing input.
The export still earns its keep at step 9. In the Journeys sheet, journeys with two or more touches hold about a fifth of revenue: 12.2% + 5.4% + 3.0% = 20.6%. Journeys with ten or more touches took 16.0 days to buy, in the same Journeys sheet. If a fifth of revenue takes around two weeks to arrive, a weekly model needs adstock that lets one week's spend keep working later.
For illustration, say a store has two years of weekly data: 104 rows. Say the store models six paid channels, two organic channels and four controls: 12 variables. If the ratio is 1 to 10, those 12 variables want 120 rows, and 104 falls short. If the store drops two low-spend channels, 10 variables want 100 rows, and 104 is enough.
Meridian's guide reaches the same place by its own route. When data runs short, it suggests fewer channels, by combining some or dropping one with low spend.
What should I check when the model looks wrong?
The baseline goes negative. Sales without marketing cannot fall below zero. Meridian reads a negative baseline as statistical error: the treatments are getting too much credit. Add better controls or tighter priors, then refit.
The smallest channel gets the biggest effect. Robyn's guide calls this out as unrealistic. Its model selection pushes away from results where the lowest spend earns the largest effect.
A channel's ROI swings with every refresh. Check whether its spend ever changed. Meridian warns that steady spend leaves the model little data for the zero-spend case, so it extrapolates.
A sales spike lands on one channel. A promotion or holiday is probably missing from your controls. Go back to step 5 and add it.
It fits the past and misses the next month. Ask for an out-of-sample test. In Robyn, ts_validation = TRUE in robyn_run() splits the series into training, validation and test periods. A model that only fits the weeks it trained on is describing, not forecasting.
One channel's ROI looks heroic. Set its share of effect next to its share of spend before you move money. Robyn's guide reads high ROI on low spend as room to grow. It also warns that a low-ROI channel with big spend may still be a big driver.
The weeks do not line up. One export starts its weeks on Sunday, the other on Monday. Robyn's guide says to agree the starting day for weekly models before anyone pulls data.
What to do this week
- Pull a four-week sample from Shopify first. In Analytics > Reports, open Total sales over time, set the time unit to week and export it. Pass: its week start day matches your ad platform export. Fail: they differ, so every row of the full pull would be shifted.
- Pull weekly cost and impressions from Google Ads. In the Campaigns table, segment by Time, then Week, for the last two years. Pass: every week has a value, with zeros for paused weeks. Fail: blank weeks, which Meridian will not run on until you fill them.
- See how many channels your buyers touch. In Google Analytics, click Advertising, then under Attribution click Attribution paths. Pass: you know whether most paths hold one channel or several before the purchase. Fail: you set the adstock lag in step 9 by guesswork.
Check the homework. Your GA4 Attribution paths export already holds the evidence. Causality Engine reads that one file and shows what each channel caused next to what last-click gave it, in 1 to 2 minutes, for €99 once (excluding VAT), refundable within 30 days. Check the homework
Sources, 1 October 2026: An Analyst's Guide to MMM (Meta); Key Features (Meta); An introduction to Meridian (Google); Collect and organize your data (Google). Amount of data needed (Google); Assess the baseline (Google); ROI, mROI and response curves (Google); FAQs (Google); Time ranges for reports (Shopify). Exporting reports (Shopify); Use segments in your tables (Google); Get started with attribution (Google)
Related answers
Frequently asked questions
Is Robyn or Meridian free to use?
Yes. Meridian's FAQ says the library is free and open source on GitHub, and Robyn is open-source R code from Meta's Marketing Science team. The real cost is time, plus someone comfortable running R or Python.How long does a first marketing mix model take?
Meta's Robyn guide estimates 4 to 6 weeks for data collection and 4 to 8 weeks for modeling in a first study. It adds that refreshes of the model can be shorter.Can I run marketing mix modeling in a spreadsheet?
You can build the weekly table there, but a plain spreadsheet regression misses adstock and saturation. Robyn's guide calls those key marketing principles of MMM, and both Robyn and Meridian model them for you.
Go deeper: Causal attribution, explained.
Sixty-second versions of these ideas: Causality Engine on YouTube Shorts.
Keep reading
Terms in this article
- AttributionAttribution identifies user actions that contribute to a desired outcome and assigns value to each. It reveals which marketing touchpoints drive conversions.
- ExperimentsExperiments are scientific procedures that test hypotheses or demonstrate facts. In marketing, experiments like A/B tests determine the causal effect of campaign changes, enabling data-driven decisions.
- Google AnalyticsGoogle Analytics is a web analytics service that tracks and reports website traffic.
- Holdout TestA holdout test is an experiment where a portion of the audience does not see a campaign. This measures the campaign's true incremental impact.
- IncrementalityIncrementality measures the true causal impact of a marketing campaign. It quantifies the additional conversions or revenue directly from that activity.
- Incrementality TestingIncrementality Testing measures the additional impact of a marketing campaign. It compares exposed and control groups to determine causal effect.
- Marketing MixThe marketing mix is the set of actions a company uses to promote its brand or product. It traditionally includes product, price, place, and promotion.
- Marketing Mix ModelingMarketing Mix Modeling (MMM) is a statistical analysis that estimates the impact of marketing and advertising campaigns on sales. It quantifies each channel's contribution to sales.