1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How do I test YPN along with existing Adsense?

Discussion in 'Publisher Network' started by LeeD, Sep 8, 2005.

  1. #1
    I need to know how to run Adsense 50% and YPN 50%. Anyone know what code to use to accomplish this?

    Thanks!
     
    LeeD, Sep 8, 2005 IP
  2. dshah

    dshah Well-Known Member

    Messages:
    1,840
    Likes Received:
    69
    Best Answers:
    0
    Trophy Points:
    115
    #2
    I am planning to write some code for this myself, if I can't find it on internet :)
     
    dshah, Sep 8, 2005 IP
  3. exaro

    exaro Peon

    Messages:
    615
    Likes Received:
    39
    Best Answers:
    0
    Trophy Points:
    0
    #3
    not a good idea to have one page that switches between two ads. the page of code still contains both instances so its technically violating TOS.

    you're better off using them on totally different sites.
     
    exaro, Sep 8, 2005 IP
  4. Willy

    Willy Peon

    Messages:
    281
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I'd tend to agree with Exaro, above, about the TOS violation. However, for instructive purposes, the actual code for switching between any two things in a 50/50 fashion is exceedingly simple in PHP:

    include((rand(0, 1) == 0) ? 'adsense.php' : 'yps.php');
    PHP:
    To use the above, you'd put AdSense's JavaScript in adsense.php and the YPS stuff (whatever that is) in the other file. Each file will have 50% chance of getting included, over the long run.

    Note that for the above code to work well, at least PHP 4.2.0 is required, otherwise you need to seed the random number generator first.
     
    Willy, Sep 8, 2005 IP
  5. UndiesHosting

    UndiesHosting Active Member

    Messages:
    219
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    78
    #5
    Thats a great use of the ternary operator.

    Would doing that violate the TOS? Becuase as far as the browser/client reads there is only 1 of the ad codes in the source. It's not possible to have them both served at one time.
     
    UndiesHosting, Sep 8, 2005 IP
  6. Jenstar

    Jenstar Active Member

    Messages:
    524
    Likes Received:
    77
    Best Answers:
    0
    Trophy Points:
    68
    #6
    I use phpadsnew to rotate both YPN and AdSense 50/50 and it works fine. It does not require you to make any javascript changes.
     
    Jenstar, Sep 8, 2005 IP
  7. alph

    alph Well-Known Member

    Messages:
    508
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    108
    #7
    I don't see how this violates the TOS, only 1 ad network brand will be shown at any given time. The other ad isn't even there as far as any client connection is concerned.

    Willy, nice code by the way....I had made something a little more complex, but yours looks much cleaner and simpler. Hurray.
     
    alph, Sep 8, 2005 IP
  8. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #8
    Depends on how you do it. It's not very hard to make a script that shows a randon ad come up with only the code for that ad loading. *hint* SSI is COOL!!!
     
    Nintendo, Sep 8, 2005 IP
  9. exam

    exam Peon

    Messages:
    2,434
    Likes Received:
    120
    Best Answers:
    0
    Trophy Points:
    0
    #9
    If the rotation is done on the server side, there's no TOS violation :)
     
    exam, Sep 8, 2005 IP
  10. Jenstar

    Jenstar Active Member

    Messages:
    524
    Likes Received:
    77
    Best Answers:
    0
    Trophy Points:
    68
    #10
    The phpadsnew setup I use does not display either company's javascript in the html source code of the page, just the phpadsnew code where either AdSense or YPN appears.

    As for a case where both ad scripts appear on the same page in the source code, I don't think there would be an issue with it violating the TOS. You might want to do a safety check in the variety of browsers to make sure they all execute it correctly and only one is displaying :)
     
    Jenstar, Sep 8, 2005 IP
  11. tresman

    tresman Well-Known Member

    Messages:
    235
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    138
    #11
    tresman, Sep 8, 2005 IP
  12. dshah

    dshah Well-Known Member

    Messages:
    1,840
    Likes Received:
    69
    Best Answers:
    0
    Trophy Points:
    115
    #12
    Can you give an overview of how you managed this. I am very very new to phpadsnew and fooling around with it for a while but still can't figure out how to do this (well in fact simple ad delivery).
     
    dshah, Sep 12, 2005 IP