Welcome to WebmasterWorld Guest from 54.198.185.204

Forum Moderators: ocean10000

Message Too Old, No Replies

Ad rotation

A not-so-simple ad rotation script

     
12:59 am on Mar 11, 2006 (gmt 0)

Preferred Member

10+ Year Member

joined:Dec 3, 2004
posts:445
votes: 0


Hello. I am asking here for ideas and logic rather than examples. Let be begin by explaining what I have been asked to do.

I have been asked to create a new ad spot on our front page. This spot is planned to have no more than 10 rotating ads at any given time. However that doesn't mean there can't be 1 or even no ads to fill the spot at any given time.

On the "users" end -- I have created a page for our designers to upload their ads if there is a spot available and put it into a que with a start date if not. This is a requirement. The designers MUST be able to upload their ads themselves.

So I am left with the task of writing a script that will:

1) rotate the ads
2) account for impressions and clickthroughs (which I already have a plan for)
3) ensure that the ads in the sytem (which that number could change day to day given the nature of the advertising) get served evenly. So even rotation is a must.

Every time I draw a plan out, my logic is flawed. Given that the total number of ads is dynamic, I seem to be having trouble coming up with a dynamic rotaion that conforms to the number of ads in the DB for even distribution. Our goal is to give each person 10,000 hits a day, -- And from what I've come up with the individual impression count could range from 5,000 to 14,000. Not a very even distribution.

Another note, for those of you who are going to suggest ad tracking software. We have a very extensive ad tracking program, however this is a very unique solution we are providing and givin the dynamics of the proposed compaign, it's just not feasible to be constantly in the tracking system changing the ads when the designers can do it themselves.

Any thoughts, comments opinions are appreciated!

-- Zak

1:20 am on Mar 11, 2006 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:July 27, 2001
posts:1472
votes: 0


A simple but slow solution would be to list the banner urls, line by line, into a single file.

The script would access this file, pull the url listed at the top of the file, serve it to the visitor, then rewrite the file placing this url at the bottom of the list, effectively pushing the next ad in the list to the top. This would guarantee a nearly even distribution of ads at the end of the day.

4:11 am on Mar 14, 2006 (gmt 0)

Junior Member

10+ Year Member

joined:Apr 3, 2005
posts:102
votes: 0


lZakl,

Assuming you are using your own database to track the impressions/clickthroughs, could you just use the count of the impressions for active ads, grouped by ad served for the given time period(1 day)?
You said you didn't want examples, but here's one anyway :)


SELECT TOP 1 imgName FROM imgImpressions
WHERE imgHitDateTime BETWEEN '2006-03-12' AND '2006-03-13'
and imgIsActive = 1
GROUP BY imgName
HAVING COUNT(imgName) <= 10000
ORDER BY COUNT(imgName)

Mark

5:18 pm on Mar 14, 2006 (gmt 0)

Preferred Member

10+ Year Member

joined:Dec 3, 2004
posts:445
votes: 0


Mark -

This is exactly the type of solution I was looking for. Since the nature of the ad would be so dynamic as to not having and end date, I think that the grouping by date would be ineffective. But couting the impressions, and serving that way is very simple and logical. What I think I will do after seeing your example, is count 2 groups of impressions. The first field of impressions would count them only for the sake of rotation, and the second field would keep acurate track of the total impressions. Then when I have an end user go to the admin page and enter another ad to run, it will reset all of the active "rotation impression counters" - as to 'start fresh'. And this way I wouldn't have to worry about killing an ad either, as the rest of the impression counters for rotation should be relatively equal. I'll give this a shot this afternoon and let you know how it turns out... Thanks for your input!

-- Zak

6:21 am on Mar 16, 2006 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 13, 2005
posts:1077
votes: 0


What I do is load the Ads for a given page into an array. Then I pick one out randomly and display it.

However, mine gets a little more complex as we allow advertisers to "weight" their ad. Ex: If the homepage Ad is listed at a minimum of $500 a month, and 4 out of 5 advertisers pay $500, but 1 advertiser pays $1000 then his ad would be shown 1/3rd of the impressions (4 * 500 = 2000 + 1000 = 3000).

Chip-

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members