Geo-Lift With CausalPy: A Verdict That Downgrades Itself
You ran a campaign in one city. Did it work? This is the instrument I built to answer that inside TrueLift, how CausalPy fits into it, and what happened when I tested it on data where I already knew the answer. It got close, and it was honest about the gap.
TrueLift is a marketing measurement product I have been building on my own since July 2026. It forecasts a number with a range, records the decision you make on it, and later grades that decision against what happened. One part of it is a causal lab: tools that answer “did it work?” and attach a verdict that weakens itself when the evidence is thin.
This case study covers the geo-lift tool in that lab, and the standalone version I built in December 2026 with CausalPy, the open-source causal inference library from PyMC Labs, doing the Bayesian part. Every chart below is interactive, and every number in them comes from running that app's own code on a synthetic dataset. No client data appears anywhere on this page.
The problem: one city, no control group
A marketing team runs something in one place: a billboard campaign, a local promotion, a regional launch. Traffic in that city goes up. The honest question is how much of the rise the campaign caused, and how much would have happened anyway because of season, a national campaign, or plain noise.
A randomised experiment would settle it, but nobody randomised anything. What you do have is every other city. The idea behind a synthetic control is to blend a handful of untreated cities into a “twin” that tracked the treated city closely before the campaign, then let the twin show what the treated city would have done without it. The lift is the gap between the real city and its twin.
The method is well known. Where most geo tests go wrong is quieter: which cities go into the twin, and who checks whether the twin deserves to be believed. That is the part I built the tool around.
The design, end to end
Two engines estimate the same twin in two ways. The first is a constrained least-squares fit: each donor gets a weight between zero and one, and the weights sum to one, so the twin is always a blend and never an extrapolation. The second is a Bayesian model of the same design, which is where CausalPy comes in. If the two disagree, that is worth knowing before anyone quotes a number.
The donor lab: choosing who goes into the twin
Most tools hand you a twin and a number. This one shows its working in three stages, because a twin built from the wrong cities gives a confident wrong answer.
Screen. A candidate city needs enough traffic to be stable (at least 30 sessions a day) and has to move with the treated city before the test (a correlation of at least 0.5). Catch-all buckets such as “(not set)” are never donors. Cities the analyst knows were exposed to the campaign can be excluded by hand.
Select. The last 28 days before the test are held back. Donors are added one at a time, and a city joins only if it makes the twin better at predicting those held-back days by more than one percent. This stops the twin from fitting noise.
Diagnose. Is the treated city inside the range its donors cover? How large is the error before the test? Does the answer collapse if one donor is removed?
With the contaminated city left in, the selection picks it first: it tracks the treated city beautifully, because it caught some of the same campaign. A good fit before the test is not evidence that a donor is clean.
Where CausalPy comes in, and the wall I hit first
CausalPy already has the model I wanted: a SyntheticControl experiment with a WeightedSumFitter, which puts a Dirichlet prior on the donor weights so they stay on the same zero-to-one, sum-to-one scale as the first engine. Using a maintained library for the Bayesian half means less of my own code to be wrong.
The first attempt failed for a dull reason. The TrueLift engine runs PyMC 6 and ArviZ 1.2. CausalPy pinned older versions of both, so the two could not be installed together. Inside the engine I wrote the same weighted-sum design by hand in PyMC 6. The standalone app has its own environment, so there it uses CausalPy itself.
Two details mattered once CausalPy was running.
The default noise prior was far too tight. CausalPy's default assumes outcome noise on the order of one unit, which suits standardised data. A city doing several hundred sessions a day is not that. I set the noise prior in session units, sized to the treated city's own day-to-day variability.
The band had to include the noise. CausalPy's default counterfactual is the model's mean prediction, which gives a narrow band that real days fall outside of all the time. For a band that an observed day can fairly be compared against, the app draws from the full posterior predictive.
The test: data where I know the answer
The only way to know whether a causal tool works is to try it where the truth is known. I generated fourteen cities that share one market trend, then planted a lift: Austin gets 18% more sessions for 28 days. I also planted a trap. San Antonio, the city next door, catches a 6% spillover. A careless analysis would use San Antonio as a donor.
With San Antonio excluded, the twin is built from Vancouver, Phoenix, Dallas and Montreal. Both engines land on the same figure: +14.3%. CausalPy puts the 94% interval at 11.0 to 17.6.
The planted answer is 18%. So the estimate has the right sign and roughly the right size, and the interval just misses the truth. I have left it that way. I did not tune the method until it hit 18, because a tool tuned to pass one test tells you nothing about the next one.
An interval describes the uncertainty the model knows about. It does not cover the choices made before the model ran, such as which cities were allowed in. That is the reason the verdict language is capped.
Trying to break the result
A lift number on its own is cheap. Before the tool reports one, it runs checks designed to embarrass it.
Placebo in space. Every untreated city takes a turn pretending to be the treated one. If several of them show “effects” as large as Austin's, then Austin's is nothing special. The comparison uses the ratio of error after the start to error before it, so a city that was badly fitted all along does not look like a discovery.
Austin ranks first of twelve, which gives p = 0.083. Note what that number can and cannot be: with twelve cities, the smallest possible p is one in twelve. A small panel cannot produce a tiny p-value, and the tool does not pretend otherwise.
Placebo in time. The same twin is asked to predict a quiet 28-day stretch before the campaign, where the true effect is zero. It found −326 sessions against a tolerance of ±406, so it passes.
Leave one out. Each donor is removed in turn and the lift re-estimated. Three of the four barely move the answer. Removing Vancouver drops it from 14.3% to 3.7%. That is a real dependence on one city, and the page shows it, which is more useful than a single number that hides it.
| Donor removed | Lift without it |
|---|---|
| None (all four) | +14.3% |
| Phoenix | +16.3% |
| Dallas | +14.2% |
| Montreal | +9.8% |
| Vancouver | +3.7% |
A verdict that downgrades itself
The output is a word as well as a number. There are three levels: causal, suggestive and descriptive. Geo-lift starts at suggestive and can never go higher, because the cities were not assigned at random and the city labels in web analytics are guessed from IP addresses. Each failed check pushes it down to descriptive, with the reason written out.
Now leave San Antonio in the donor pool. The selection picks it, the lift estimate drops to 12.1% because the twin has absorbed part of the campaign, and Austin falls outside the range of its two donors on 27% of days. The range check fails and the verdict drops by itself. Nobody has to notice the contamination for the tool to stop vouching for the number.
On real web data this has already earned its keep. A city's summer surge that looked like a clear win was ruled descriptive, because every plausible donor had been touched by the same campaign. The lab made that visible. A p-value would have hidden it.
Could this design even see it?
The last question is one most analyses never ask: if there were a lift, would this set-up have found it? The power panel injects fake lifts of 0, 5, 10, 15 and 25% into eight past windows and runs the full set of checks on each.
The result is uncomfortable, and I am publishing it anyway. With no lift injected, the design raised no false alarms. But it detected a real lift in only half the windows, even at +25%. In the other windows the design stopped itself, most often because Austin had drifted outside the range of its donors. Two of the eight windows overlap the weeks where the real lift was planted, so those two are not clean simulations. In the six clean windows it caught four of six at +10% and above, which is still short of the 80% the tool asks for before it calls a lift detectable.
The conclusion is that this city, with these donors, is a weak place to run a test, and that a bigger campaign would not fix it. The tool says so in plain words: change the design (a larger city, a wider cut of traffic, a calmer period). It is far better to learn that before spending the budget than after.
The sibling tool: “Did it work?” with no other cities at all
Sometimes there is no second city to compare with: one website, one known date, a change went live. TrueLift's other causal tool handles that case with an interrupted time series, built on the same principle of running two engines and trying to refute the answer.
The verdict falls to descriptive if the placebo fails or if any other known change (a spend step, a campaign launch, a note on the calendar) lands inside the window. It stays at suggestive if the placebo could not run or the sampler did not converge. The tool finds those other changes by itself, by scanning ad spend for sudden steps and for campaigns that started or stopped.
What I took from building it
Choose the comparison before the model
The donor pool decided more of the answer than the statistics did. Leaving one contaminated city in moved the estimate and broke the design.
Test on a known answer, then publish the miss
The tool recovered 14.3% of a planted 18%. Knowing how far off it can be is worth more than a demo that happens to land.
Make the tool say no
A measurement tool that always returns a number will be trusted on the days it should not be. The verdict and the power panel exist to refuse.
Use the library, check its defaults
CausalPy saved me from maintaining my own Bayesian model. Its default priors still had to be rescaled to the data before the output meant anything.
What it is built with
TrueLift is live at truelift.io. The ideas underneath this tool are covered in plainer terms in what incrementality means and which numbers tell you an ad worked.
Running a regional campaign and want to know if it worked?
The most useful time to talk is before the campaign starts, when the test can still be designed so that it is able to give an answer.
Start a conversationAll figures on this page come from a synthetic panel of fourteen cities generated with a fixed seed, with a planted 18% lift and a planted 6% spillover. Synthetic control follows Abadie, Diamond and Hainmueller; the placebo ranking uses Abadie's post-to-pre error ratio. Intervals are 94% posterior intervals from two chains of 800 draws. CausalPy is an open-source library from PyMC Labs.