|
|
|
|
![]() ![]() |
Dec 12 2004, 05:43 AM
Post
#1
|
|
|
Premium Member Group: Members Posts: 240 Joined: 13-November 04 From: Arizona Member No.: 1,356 |
alright, I know a few different ways to make a random banner with php - where a different banner would rotate with every refresh/click. But I've had some "customers" complain how they think their banner should show up more then others for one reason or another, and I completely agree with them. So now I kinda want to have a code (most perferably php or javascript) that would have the banner rotation where I could set a peticular banner to show up say 15% of the time and another 5% so I could satisfy my more loyal members over the ones simply looking for more hits to their site. Can someone give me a way of doing this?
And I don't want to do something like this: banner1.gif banner1.gif banner1.gif banner1.gif banner2.gif banner2.gif banner2.gif banner2.gif banner2.gif banner3.gif banner3.gif banner4.gif banner5.gif banner6.fig because I'm a too lazy to make those kind of calculations everytime someone joins my banner rotation system. Alright then. THanks in advance for anyone willing to help me out here |
|
|
|
Dec 12 2004, 10:01 AM
Post
#2
|
|
|
Super Member Group: Members Posts: 595 Joined: 4-September 04 Member No.: 228 |
Problem wuth that kind of system is that... If you promise one of your advertisers say 15% of the time. That meaning that of 100 page loads their ad should be displayed 15 times.
But what happens when you add new advertisers to your system? You only have 100% of page loads and if you add more advertisers the percentage of other's ads has to drop. Anyways, let's say that you have set number of advertisers. What you can simply do is save table like this: ad1 -> 15 ad2 -> 30 ad3 -> 50 ad4 -> 100 There ad1 and ad2 would have 15% chanhe of being vieved, ad3 20% and ad4 50% change. Than just create random numbers ranging from 1 to 100 and loop through your table like this: CODE $rand = rand(1, 100); foreach ( $ads as $ad_number => $limit ) { if ( $rand <= $limit ) { $ad_to_view = $ad_number; break; } } |
|
|
|
Dec 12 2004, 11:33 AM
Post
#3
|
|
|
Premium Member Group: Members Posts: 382 Joined: 5-September 04 Member No.: 255 |
I would recommend a adserving system based on php and mysql to you. It's called phpAdsNew, a free open-source system. You can download it at http://www.phpadsnew.com. In fact i think you have this script in in your cpanel's scripts section.
Once you installed it, you basically can run an adserver like Valueclick or the other major ad firms, except perhaps phpadsnew is less "pro". Anyway, you can set priority to different banners. Say if you want banner A to appear more than banner B, then you can give a heavier weiht to banner A, and the adserver will make the calculation and serve your ads the way you want it. hope this helps |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 5th December 2008 - 07:57 AM |