YPN and Adsense ads 50-50

Discussion in 'Publisher Network' started by dshah, Sep 12, 2005.

  1. #1
    well, picking up tips from various forum posts, I finally managed doing this 50% yahoo and 50% adsense ads generation on a page using rand(0,1)

    check it out at www.photographersstop.com (homepage)

    I am using a rand(0,1) to get either 1 or 0.
    If its 0 then show google ads (and adlinks)
    if its 1 then show yahoo ads (no adlinks) :(

    However it doesn't 'exactly' generate yahoo and google ads 'alternatively', but on a longer run both should be 50/50 priority. (I am trying to figure out way to replace rand by something mroe precise).

    I am sad to loose adlinks impression at 50% times, I hope yahoo comes up with something like it :)

    now need to extend this to other pages



    (Probably using phpadsnew would be better option if you have only one ad unit on a page, for me its not case though)
     
    dshah, Sep 12, 2005 IP
  2. honey

    honey Prominent Member

    Messages:
    15,555
    Likes Received:
    712
    Best Answers:
    0
    Trophy Points:
    325
    #2
    honey, Sep 12, 2005 IP
  3. Shoemoney

    Shoemoney $

    Messages:
    4,474
    Likes Received:
    588
    Best Answers:
    0
    Trophy Points:
    295
    #3
    phpadsnew is nice but alot of overkill for something this simple IMO

    however phpadsnew can detect if other ads are running so if you run like 3 ads you could be sure you are running them all yahoo or google to comply with TOS stuff.
     
    Shoemoney, Sep 12, 2005 IP
  4. dshah

    dshah Well-Known Member

    Messages:
    1,840
    Likes Received:
    69
    Best Answers:
    0
    Trophy Points:
    115
    #4
    good input for me. I tried with phpadsnew and somehow could not get it working (I think I couldn't understand phpadsnew system) on my test env.
     
    dshah, Sep 12, 2005 IP
  5. dshah

    dshah Well-Known Member

    Messages:
    1,840
    Likes Received:
    69
    Best Answers:
    0
    Trophy Points:
    115
    #5

    LOL:D its same thing. I have been thinking of how to do it but what really helped was a post on this forum
     
    dshah, Sep 12, 2005 IP
  6. Jester

    Jester Well-Known Member

    Messages:
    202
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    148
    #6
    Jester, Sep 14, 2005 IP
  7. noppid

    noppid gunnin' for the quota

    Messages:
    4,246
    Likes Received:
    232
    Best Answers:
    0
    Trophy Points:
    135
    #7
    That code is nice, however it only takes into consideration one ad. Using that code with multiple instances as where folks display say three ads, could get you in trouble.

    You may want to consider this method...Displaying Adsense and YPN Ads on a Web Page.
     
    noppid, Sep 14, 2005 IP
  8. dshah

    dshah Well-Known Member

    Messages:
    1,840
    Likes Received:
    69
    Best Answers:
    0
    Trophy Points:
    115
    #8
    Nope, the above code can support any number of ad units and of any types. Its upto you how you want to use this flag (adsense or ypn)
     
    dshah, Sep 14, 2005 IP
  9. Jester

    Jester Well-Known Member

    Messages:
    202
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    148
    #9
    An easier way would be to use Shoe's code and just leave one line out of the code for the 2nd and 3rd instances of your ads.

    First ad on the page:

    < ?php
    $number=mt_rand(1, 2);
    if ($number=="1") {
    include "adsense.txt"; #include the text file with adsense code 
    }
    else
    {
    include "YPN.txt"; #include the text file with ypn code
    }
    ?>
    
    PHP:
    Following ads:

    < ?php
    if ($number=="1") {
    include "adsense.txt"; #include the text file with adsense code 
    }
    else
    {
    include "YPN.txt"; #include the text file with ypn code
    }
    ?>
    
    PHP:
    Works like a charm.

    J
     
    Jester, Sep 15, 2005 IP
  10. noppid

    noppid gunnin' for the quota

    Messages:
    4,246
    Likes Received:
    232
    Best Answers:
    0
    Trophy Points:
    135
    #10
    I just spelled it out for folks that don't have the coding experience. I'm sure both will be helpful.
     
    noppid, Sep 15, 2005 IP
  11. Shoemoney

    Shoemoney $

    Messages:
    4,474
    Likes Received:
    588
    Best Answers:
    0
    Trophy Points:
    295
    #11
    thanks the above code is a quick and easy way to do it. I am not really a coder but can script a bit to get by ;)

    If you were going to run multiple ads I would highly recomend phpadsnew or some sort of management that can detect what your running and run ads based on that. Also it has features like geotargeting and time of day placement which can be really nice if properly tuned.
     
    Shoemoney, Sep 15, 2005 IP