...

View Full Version : Showing ads only to 20% percent of visitors. Or different ads to another 80% visitors



basketmen
07-31-2012, 08:49 AM
Hi guys, how to do this in a php file

Showing ads only to 20% percent of visitors. Or showing different ads to another 80% visitors

any way that can work, maybe using time intervals, like the visitors that visit the site at minute 0-12 only that show it, and visitors that visit the site at minute 13-59 is not. Or another methode

please help or share if you have, this should be easy enough and many people should need it, already googling it but still cant found it

MarkR
07-31-2012, 11:02 AM
Easiest way would be to generate a random number and do it on a 'dice role'




if ( mt_rand ( 1 , 5 ) == 5 )
display_advert();
else
do_something_else();

Len Whistler
07-31-2012, 07:56 PM
Maybe using time intervals, like the visitors that visit the site at minute 0-12 only that show it, and visitors that visit the site at minute 13-59 is not.


Take a look at the php date function.

Untested, might be syntax errors

$minutes = date("i"); //i minutes with leading zeros, 00 to 59

if ($minutes <= 12) {
// do this
} else {
// do this
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum