How to Prepare Input Data for Meta Robyn, Column by Column
Meta Robyn input data, column by column: date, revenue, spend, impressions, organic and context variables, Prophet holidays, a demo-based layout and pre-run checks.
On this page
Meta Robyn's input data requirements for spend, impressions and revenue fit in one flat table: a date column, one revenue or conversion column, a spend column for every paid channel, an optional exposure column such as impressions for each of those channels, and the organic and context columns that explain the rest of the sales line. Each row is one day, week or month. The mapping below follows Robyn 3.12.1, the version named in the header of the official demo script on 6 November 2026, and gathers the pre-run checks the demo leaves spread across its code comments.
If the team is still choosing a measurement method, start with what incrementality measures.
What goes in a Robyn input table
Robyn's official documentation sets input data requirements for the date variable, revenue, spend and impressions one argument at a time, mostly in the help text of Robyn's inputs.R. The table maps each argument to the columns of the demo dataset.
| Argument | Demo column(s) | What the column must hold |
|---|---|---|
date_var | DATE | YYYY-MM-DD dates, one row per day, week or month |
dep_var | revenue | One numeric column; only one dependent variable is allowed |
dep_var_type | (a setting) | "revenue" or "conversion", which decides whether Robyn reports ROI or CPI |
paid_media_spends | tv_S, ooh_S, print_S, facebook_S, search_S | Numeric spend at zero or above; mandatory |
paid_media_vars | tv_S, ooh_S, print_S, facebook_I, search_clicks_P | Exposure such as impressions, clicks or GRP, in the same length and order as the spends |
organic_vars | newsletter | Numeric activity without a clear spend, such as newsletter sends or social posts |
context_vars | competitor_sales_B, events | Competitors, price and promotion, temperature, unemployment and similar |
factor_vars | events | The categorical columns among the context variables |
window_start, window_end | 2016-01-01 to 2018-12-31 | The modeling period inside the full table |
Two naming rules cover the whole table: no spaces in column names and no duplicates. Columns you load but never assign are listed as unused variables when you print the InputCollect object, which makes the print a quick audit of the role Robyn gave every column.
How spend and impressions work together
The Meta Robyn data preparation steps for spend, impressions and revenue start with pairing columns. Every paid channel needs a spend column, which Robyn's analyst guide asks for so ROI can be calculated, and the exposure vector must list channels in the same order as the spend vector. A channel with no exposure metric repeats its spend column name in both.
Robyn's feature documentation says exposure metrics in paid_media_vars are prioritized for fitting, with spend as the fallback, and that this behavior was reactivated in v3.12.0. In the 3.12.1 code, Robyn divides window spend by window exposure to get a cost per exposure for each such channel, multiplies the exposure series by it, and models that rescaled series. Hyperparameter names follow the modeled column, which is why the demo sets facebook_I_alphas for Facebook.
Robyn then scores how closely spend tracks the rescaled exposure inside the window, using an R-squared threshold of 0.8 that the 3.12.1 message labels adjusted R-squared, and prints a note suggesting channel splits only when two or more channels fall below it. The help text recommends splitting weak channels into sub-channels such as prospecting and retargeting. That same help text still says paid_media_vars columns are not used to train the model, which conflicts with the features page and the code, so read the source of the version you install.
Robyn's analyst guide calls exposure metrics best practice, advises against clicks because they miss view-through conversions, and treats spend as a last resort. The demo still models search on search_clicks_P. Paid media coefficients default to positive signs, so a search column with no positive effect lands at zero, a pattern traced in why Robyn shows zero or negative paid search ROI.
Revenue or conversions as the dependent variable
dep_var accepts one numeric column. With dep_var_type set to "revenue", Robyn calculates ROI; with "conversion", for orders, sign-ups or leads, the help text says it calculates CPI in its place. The analyst guide names sales as the most common choice and points teams to the KPI that matters most in financial reporting. Pick the column finance already reconciles, because every channel's return is measured in its units.
Organic, context and factor columns
Organic columns such as newsletter sends go through the same adstock and saturation transforms as paid media, so the demo gives each one hyperparameter ranges. Context columns enter the regression untransformed, according to the analyst guide. Two details from Robyn's checks.R trip up first builds. factor_vars must be a subset of context_vars, even though a demo comment mentions organic variables too, and any non-numeric context column is turned into a factor automatically. A context or organic column named trend, season or holiday also clashes with the Prophet term of the same name when that term is switched on, because every independent variable needs a unique name. For which controls to include, see how to choose MMM control variables.
Weekly or daily data, and where holidays come from
Robyn MMM input data format requirements begin with the time grain. Robyn reads the gap between the first two dates in the table: 1 day means daily, 7 days weekly, 28 to 31 days monthly, and any other gap stops with an error. Monthly rows must sit on the first day of the month, which the Prophet step enforces with an error. Robyn checks only the first two dates for duplicates, so panel data, with geo or store rows sharing each date, stops there with a message about panel data. Sum those rows to a single row per period first, and test the rest of the date column for duplicates yourself.
The analyst guide recommends weekly data as best practice, asks for at least two years of weekly history and more when only monthly data exists, and accepts daily data with extra validation. The window_start help text asks for at least one year in the full table, because trend, seasonality and holidays are estimated on every row while the window limits the media, organic and context regression. It also advises starting the window after the first date so adstock can carry in from earlier periods.
prophet_vars accepts trend, season, weekday, monthly and holiday. The help text recommends all of them for daily data and trend, season and holiday for weekly or coarser data. Holidays come from dt_prophet_holidays, a table with the columns ds, holiday, country and year, and prophet_country takes one code that must exist in it. Custom events such as school breaks go in as extra rows with the same four columns and your country code, as the demo suggests.
For weekly data, Robyn moves each holiday to the start of its week, takes the starting weekday from your first date, and joins the names of holidays that share a week. Align the week definition across every source before export so revenue, spend and holidays describe the same seven days. On daily data with no factor variables, 3.12.1 also prints a warning about a known Prophet issue that can crash the run.
A sample layout from the demo dataset
Robyn's official demo CSV shows date, revenue, spend and impressions prepared in one file. The demo dataset in the repository, a CSV copy of the dt_simulated_weekly table the R demo loads, holds 208 weekly rows dated on Mondays, from 23 November 2015 to 11 November 2019. Its first row, rounded to whole numbers:
| Column | Role | First-row value |
|---|---|---|
| DATE | date | 2015-11-23 |
| revenue | dependent variable | 2,754,372 |
| tv_S | spend, modeled directly | 22,358 |
| ooh_S | spend, modeled directly | 0 |
| print_S | spend, modeled directly | 12,728 |
| facebook_S | spend | 7,607 |
| facebook_I | impressions, modeled | 24,301,284 |
| search_S | spend | 0 |
| search_clicks_P | clicks, modeled | 0 |
| competitor_sales_B | context | 8,125,009 |
| events | context, factor | na |
| newsletter | organic | 19,402 |
The events column reads "na" on 206 rows and names an event on the other two. In this CSV the demo's window start of 2016-01-01 moves to the nearest date in the data, 4 January 2016, and the window runs to 31 December 2018, 157 weeks. The weeks outside it still feed Prophet's trend and seasonality.
Checks to pass before the first run
A step by step Meta Robyn data preparation guide ends with checks, and Robyn runs most of them inside robyn_inputs():
- No missing or infinite values in the media, organic, context or holiday columns.
- Paid media values at zero or above. A column whose values are all zero or below is converted to absolute values without a message, so look at any column stored as negatives, such as refunds, before loading it.
- No zero-variance columns, and no media channel that is all zeros inside the modeling window.
- Spend and exposure vectors of equal length, in the same channel order.
- At least ten rows for every independent variable, counting the Prophet terms you switch on. Robyn warns below that ratio, and it counts every row in the table, including rows outside the window.
A hypothetical example shows how fast the ratio binds. A retailer with two years of weekly data has 104 rows, enough for about ten variables. It wants trend, season and holiday, six paid channels, two organic columns and two context columns, 13 independent variables in all, so the 10:1 rule asks for 130 rows and Robyn warns. Merging two small social channels lowers the need to 120 rows, still above 104. A third year of history, 156 rows, clears it. The demo specification, applied to the CSV above, puts 11 independent variables against 208 rows.
Robyn leaves the rest to you. It infers the interval from the first two dates, and we found no check in checks.R for gaps further down the table, so test the spacing of every row yourself. The analyst guide asks you to chart each series against the media plan, look for gaps and errors, watch for independent variables that move together, and allow at least four weeks for data collection.
Once the table passes and a model fits, validate it before you shift budget. Teams weighing Robyn against Google's framework will find the input differences, geo-level data included, in Google Meridian vs Meta Robyn. Measurement projects like this sit with our data analytics team, and Attribution Doctor is a further resource for the attribution numbers an MMM usually gets compared against.
Sources
Robyn's documentation, source code and demo data on the main branch were read on 6 November 2026.
