SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot
    Join Date
    Oct 2007
    Posts
    100
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

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

    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
    Make the world better

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,400
    Mentioned
    147 Post(s)
    Tagged
    4 Thread(s)
    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%.

  3. #3
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,747
    Mentioned
    64 Post(s)
    Tagged
    0 Thread(s)
    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.
    Never grow up. The instant you do, you lose all ability to imagine great things, for fear of reality crashing in.

  4. #4
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Just in case you really wanted to use start/end of hour:
    PHP Code:
    echo (date('i') < 12 ) ? '<img src=banner1.jpg>' :  '<img src=banner2.jpg>'


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •