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

2 replies
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
#20% #80% #ads #percent #showing #visitors
  • Profile picture of the author Tradeout
    If you want to show ads based on the times you mentioned then something like this will do the job

    PHP Code:
     
    if(date("i") > 12)
    {
       
    // Insert HTML for advert between 12 - 59 minutes
     
    }
    else
    {
       
    // Insert HTML for advert between 01 - 12 minutes
     

    {{ DiscussionBoard.errors[6708041].message }}
  • Profile picture of the author Tradeout
    Also, if you wanted to show content with 80/20 split using chance you could use something like this

    PHP Code:
     
    if(mt_rand(1,100) >= 80)
    {
      
    // Show 20% chance ad
     // HTML
     
    }
     
    else
    {
      
    // Show 80% chance ad
      // HTML
     

    {{ DiscussionBoard.errors[6708060].message }}

Trending Topics