Skip to content

Affiliate campaign rotation: how an engine decides which campaign to show

Ten eligible campaigns, three slots: which go first? Exploration, exploitation and a little Bayesian statistics, explained without formulas.

By convli teamPublished Last updated: 5 min read
Cover illustration: Affiliate campaign rotation: how an engine decides which campaign to showconvli

Affiliate campaign rotation is the mechanism that decides, on every impression, which of the eligible campaigns fills each slot in the widget. Suppose the country filter has done its job and ten campaigns remain that a reader in Colombia can genuinely use on a travel article. The widget has room for three. Which ones? The naive answer is “the ones that pay most”. The right answer is “the ones that will perform best for this site, in this country, today” — and that answer has to be learned.

This article explains how the learning rotation engine behind our widget formats works, why the classic approach of “test everything equally for two weeks” is slow and expensive, and which design decisions separate a good engine from one that merely looks smart.

Why is explore-or-exploit a dilemma?

Every impression is a bet. If we always show the campaign that has performed best so far, we win the sure thing but never discover whether another would do better. If we split impressions equally, we learn a lot but give traffic away to mediocre campaigns. This is the explore-or-exploit dilemma, with decades of literature under the name “multi-armed bandits”: each campaign is a lever on a slot machine and we want to maximize the total prize without knowing the odds.

The practical question for a publisher or a content creator is not which algorithm is best in theory, but which one makes good decisions with little data, adapts when conditions change and can be explained when someone asks “why did this campaign show up?”.

How does Thompson sampling work, without formulas?

The technique that best balances those demands is called Thompson sampling. The idea fits in three sentences. For each campaign we keep not a performance figure but a distribution of beliefs: “I think its rate is between this and that, with this much certainty”. On every impression we draw a random number from each distribution and show the campaign that drew the highest. Each observed outcome — a click, a conversion, nothing — adjusts that campaign’s distribution.

The elegant part is that exploration comes for free. A new campaign has a wide distribution (lots of uncertainty), so it sometimes draws high numbers and receives traffic; as it accumulates data, the distribution narrows around its true value. A campaign that has proven weak draws low numbers almost always and stops appearing, without anyone switching it off by hand.

A good engine does not pick the best campaign: it picks the one most likely to be the best, and revises that belief with every impression.

Why learn per country, not on average?

The most important design decision is granularity. If a single distribution is learned per campaign, the engine averages different markets and makes wrong decisions in all of them. An electronics store can be unbeatable in Mexico and mediocre in Peru because of prices, shipping or brand. With distributions per campaign and country (identified by its ISO 3166 code), the engine discovers that difference and exploits it: in each country the winner is whoever actually wins there.

The price is more distributions to feed, and in small countries data takes longer to arrive. A sensible prior — the initial belief — helps there, as does inheriting part of the global signal while the local one matures. How the reader’s country is determined, and how accurately, is covered in our geolocation guide.

What happens when conditions change?

A campaign that performed brilliantly in March may not in September: the price changed, the product sold out, the brand stopped shipping to a country. An engine that remembers everything forever becomes stubborn. The fix is a moving window, say fourteen days, with decay: recent observations weigh more than old ones and last month’s barely count.

With that short memory a change in conditions shows within days. And because new campaigns start with high uncertainty, they enter play immediately without a manual “test phase”.

What is optimized, and who decides?

Performance can mean different things. Revenue per thousand impressions is the natural objective for a publisher; click-through rate suits discovery content; conversions when the brand relationship demands it. An honest engine lets each publisher choose the objective per property, with a sensible platform default, and learns with the right metric.

There is also an exploration floor: a small share of impressions (say 5%) is always spread among the least-tested campaigns. Without that floor an early winner could monopolize traffic and the engine would never learn that something better arrived.

Explaining the decision

An engine that cannot be explained cannot be trusted. That is why it pays to show, per country, who receives the traffic and why: how much of their share comes from merit (proven performance) and how much from exploration (uncertainty), the expected versus observed rate, how many campaigns were eligible and how many were blocked by country. With that view an editor understands the system in a minute and an administrator spots an inventory problem before it costs money.

One precondition remains: the engine only learns well if the observations are real. Bot clicks must be filtered out before they are counted, following the MRC invalid traffic guidelines, which is why rotation and fraud detection go hand in hand. Rotating well is not a technical luxury. It is the difference between distributing impressions and converting them.

Frequently asked questions

How many impressions does the engine need before it decides well?

There is no fixed number: Thompson sampling makes reasonable decisions from the first impression and improves them as data arrives. In a low-traffic country, the prior and the global signal keep the early decisions from being random.

Can I force a specific campaign to always show?

Yes, but do it as an explicit rule, for example a direct deal with the brand, rather than by tampering with the engine. Pinned campaigns are served outside the rotation and do not contaminate what the engine learns about the others.

What is the difference between learning rotation and an A/B test?

An A/B test splits traffic equally for a fixed period and decides at the end; learning rotation shifts traffic toward what performs while it keeps measuring. It costs less traffic and adapts when the winner changes.

convli team · convli · Last updated: September 11, 2026

Ready to earn from what you already publish?

Create an account and add your first property in minutes.