Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Community Discussions (All other subjects)
 Banner 'weights'...
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

D3mon
Senior Member

United Kingdom
1685 Posts

Posted - 21 February 2003 :  19:49:02  Show Profile  Visit D3mon's Homepage
I'm developing some banner rotation code but can't work out how to implement a banner 'weighting' system. At the moment, a banner is selected at random, but I'd like to be able to give each banner a particular 'weight' which will affect its likelyhood of being chosen...

Can anyone guide me carefully through the mathematical principle behind this process?


Snitz 'Speedball' : Site Integration Mod : Friendly Registration Mod
"In war, the victorious strategist only seeks battle after the victory has been won"

Bookie
Average Member

USA
856 Posts

Posted - 21 February 2003 :  22:28:40  Show Profile  Visit Bookie's Homepage  Send Bookie an AOL message  Send Bookie a Yahoo! Message
What if you generate a random number between (and including) 1 and 10. Let's say you have three ads and you want one add to show 60% of the time, another to show 30%, and the last 10%. Generate the random number and then use a series of if/then statements. The following won't be actual code, just explanatory...

if random_number = 1 through 6 then
... show ad 1
elseif random_number = 7 through 9 then
... show ad 2
elseif random_number = 10 then
... show ad 3.
end if

Just a thought. I don't know how many ads you are dealing with or how hard this would be to code. It just seems like a reasonable solution to give weight to certain ads. I hope this helps!

Participate in my nonsense
Go to Top of Page

DavidRhodes
Senior Member

United Kingdom
1222 Posts

Posted - 22 February 2003 :  06:34:05  Show Profile
if you use the ASP AdRotator (MSWC.AdRotator), weighting is a built in feature

The UK MkIVs Forum
Go to Top of Page

VodkaFish
Average Member

USA
654 Posts

Posted - 22 February 2003 :  19:23:53  Show Profile  Send VodkaFish an AOL message  Send VodkaFish an ICQ Message  Send VodkaFish a Yahoo! Message
Another way to do it is through counting how many times you've shown the ad and using a math/if system. Do a comparison between the sums and if something is above a certain amount, move on to the next, the next one is above whatever amount, move on as well... until one hits. Sounds more complicated then it is.

v ø d k â f ï § h
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.3 seconds. Powered By: Snitz Forums 2000 Version 3.4.07