Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Advanced Banner-Rotation Algorithms

I'm going to be starting a banner-rotation script soon and I'm getting a bit perplexed over how exactly to develop it. Suppose a client asks for

"10,000 impressions in the next 10 days for $10,000 dollars."

Another client asks for

"1,000 impressions for $100 dollars."

And a third asks for

"1,000 clicks or 10,000 impressions for $5,000."

How exactly do I determine which banner to show upon a page-request? How do I weigh one against another? Clearly the first request is rather important, as I'm expected to serve a set number of impressions within a time-window.

The second client is not nearly as important, as they don't care about a time-window, they just want some face-time.

And the last client wants to place an n or m restraint on the impressions/clicks, making matters slightly more difficult.

I'm already pretty confident that I'll need to abstract some weight from these scenarios to determine who gets the most attention. My question is what type of algorithm could handle this, and secondly how could I serve up banners by weight without always serving up the most important banner with each request?

like image 854
Sampson Avatar asked Aug 03 '09 18:08

Sampson


3 Answers

The difficulty comes from the time constraint more than anything else. I would divide anyone's priority who did not specify a time constraint by 365 (a year), and then use time as part of the weight factor. So:

Client 1 priority: 10000/10 = 1000 
Client 2 priority: 1000/365 ~ 3 
Client 3 priority: 10000/365 ~30

That should get you a fairly decent indicator of priority. Now, you can't mix and match impressions and clicks can you? They either go the impression route or the click route. Seeing as you cannot control click, but you can control impressions (at least, moreso than clicks), I would weigh it according to impressions.

like image 143
AlbertoPL Avatar answered Oct 12 '22 03:10

AlbertoPL


Use a random-number generator to pick which ad to show, and weight it with a priority for each ad. Set the weighting factor higher for clients that want more impressions or have a deadline. You can increase weighting factor if the time is almost up.

Once a client hits their requested impressions, drop weighting to 0 to prevent their ad from showing.

Default weighting could be 1 or so, with clients being allowed to pay extra to increase priority (without telling them the mechanics -- bill it as "premium" placement, etc).


Edit: weighting details

You can make this as simple or complex as you like, but a basic version would include the following terms:

  • weight is 0 if ad has reached purchased impressions/clicks
  • base weighting (1.0 probably)
  • multiply weight by impressions_remaining / TOTAL impressions remaining for all clients
  • add a small constant if remaining impressions/clicks is small -- ensures they get the last few ones needed to finish the account
  • for deadline clients: add term for (remaining impressions/purchased impressions)/(time left/total time)

The deadline clients should be capped at 90% of all page displays or something to ensure they don't outcompete others. The last term gives the "urgency" for deadline clients -- it goes to infinity as deadline hits, so you should put a condition on the remaining time piece to prevent problems with this.

like image 28
BobMcGee Avatar answered Oct 12 '22 02:10

BobMcGee


Microsoft Commerce Server contains a NOD algorithm (see http://msdn.microsoft.com/en-us/library/ms960081%28v=cs.70%29.aspx and http://msdn.microsoft.com/en-us/library/ee825423%28v=cs.10%29.aspx )

I've used derived versions of this formula in 3 different ad servers, which turned out to work nice for my conditions.

The basic formula regarding your situation uses a variable called NOD, short for "Need of Delivery". At any given time, the "basic" NOD formula of a banner is:

NOD=(Remaining Events / Total Events Requested) * (Total Runtime / Remaining Runtime)

Note that "Events" is a general term, which may represent impressions, clicks, conversions, etc. depending on your system.

The equation states that all banners start with the initial value of 1.0 to their lives, because (e / e) * (t / t) = 1.0

A higher-than-1 NOD value means you are behind your schedule, while a NOD between 0 and 1 generally means that you have displayed the banner "too fast". Values between 0.9 and 1.2 are generally in acceptable range (this is not a technical range, rather a business experience).

As long as the serving ratios match duration ratios, values stay around 1.0.

For a specific ad slot, the algorithm checks the NODs of all available banners targettable on the slot. Suppose you have 3 banners available on a slot, with NOD values 0.6, 1.35 and 1.05, which add up to 3.0. Then relative probabilities of each banner to be displayed become 20%, 45% and 35% in order [ 0.6 / (0.6 + 1.35 + 1.05)] = 20%

The algorithm uses weighted probability distribution, which means that even the banner with the least NOD value has the chance to be displayed. While the basic formula uses this approach, business decisions generally always forced me to implement algorithms favoring the urgent NOD values more than the original formula. So, I took the base NODs and multiplied them with themselves. In the same example, probabilities become 11%, 55,5% and 33,5% in order.

For your condition, you might consider changing the formula a little bit to serve your needs. First to be able to compare the income you will earn by displaying a banner, you should convert all display types (impression, click, action, etc) to a common eCPM value. Then you might use this eCPM as a multiplier to the original equation.

Calculating eCPM (effective CPM) might be tricky for not-yet-published campaigns, in this case you should use historical data.

Let me explain this part a little bit more: When trying to compare the probable income you will earn by "displaying" a single banner, you don't need to compare impression based budgets. For click based budgets, you should use historical CTR value to guess "how many impressions does my system need to serve to get X clics". A more advanced algorithm might utilize "how many impressions does my system need to serve to get a campaign in X category, in y inventory".

Then your final equation becomes:

NOD = eCPM * (Remaining Events / Total Events Requested) * (Total Runtime / Remaining Runtime)

You can always consider using powers of eCPM to compare the results. Like my way of changing the original formula to favor more urgent campaigns, you might favor "more paying" campaigns.

like image 22
adnan korkmaz Avatar answered Oct 12 '22 01:10

adnan korkmaz