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
Maybe using rand(1, 100) ?
If the value is 1-20 show one add.
If the value is 21-100 show another.
Being a random generator, on large numbers it should give you your 20-80%.
well i'd suggest using mt_rand instead of rand, but yeah. Guido's answer is the correct one; you cant assume to have the same number of users each minute in order to do a by-time delivery and have it be (over time) accurate to 80/20.
Just in case you really wanted to use start/end of hour:
echo (date('i') < 12 ) ? '<img src=banner1.jpg>' : '<img src=banner2.jpg>';
This topic is now closed. New replies are no longer allowed.