1

Suppose there are 3 ads that my system can deliver. If I want all three to be delivered roughly the same amount of times over the course of a week, I can just choose a random number between 1-3 each time, then deliver ad 1, 2, or 3.

var ads = [
   {id: 1, img: '/img/ad01.jpg'},
   {id: 2, img: '/img/ad02.jpg'},
   {id: 3, img: '/img/ad03.jpg'},
];

var rand = Math.random() * ads.length | 0;

//          v------ This ad will be delivered ~33% of the time
return ads[rand];

What I need to do

1. Each ad is to be scheduled to run between some date range

2. I need to deliver each ad a different percentage of the time, such as:

var share = [
   {adId: 1, share: 20}, // <----- adId 1 is shown ~20% of the time
   {adId: 2, share: 30},
   {adId: 3, share: 50}
];

3. Some ads may have further constrains, such as not being shown between certain hours, days of the week, etc.

Challenges I've faced

  1. I don't know necessarily how many page views I'll generate during the time frame each ad is scheduled to run.
  2. I don't know how to boost the amount of impressions one ad gets over the others based on its current pacing, and yet more or less guarantee that it receives the percentage of page views it was configured for.

Edit

To clarify,

I am storing all of this information in the server. That's where all the ads are stored, along with all of the settings such as when they are delivered, what percentage of the time, etc. What I'm asking is how to calculate their current pacing, and adjust when each ad is delivered.

rodrigo-silveira
  • 12,607
  • 11
  • 69
  • 123

1 Answers1

2

(( If you have another idea please let me know ))


In short:

The algorithm to deliver ads evenly until their budget depletes.

where:

ratio     = when to display ads
target    = targeted impressions to be made by all ads
capacity  = total requests
accrued   = impressions being made

All the values should be calculated only for the period. For example: Capacity = total requests incoming only for the defined period (ie. total requests incoming in 1 hour), not the entire time.

Details:

What that equation does is that defining a spending ratio which you can incorporate in your randomization logic. So that, only on that part of the requests ads will be displayed.

You have to sum all the requests for the given period. By period I mean, a time range for example: 1 hour maybe. After, each period ends reset the request counting to 0.

And, by using the above equation you can calculate when to show ads. Of course, you will going to need a weighing algorithm among the ads, but that is another issue.

Community
  • 1
  • 1
Inanc Gumus
  • 25,195
  • 9
  • 85
  • 101