I need to know how to run Adsense 50% and YPN 50%. Anyone know what code to use to accomplish this? Thanks!
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.
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.
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.
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.
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.
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!!!
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
For random rotation have a look at http://www.alistapart.com/articles/betterrotator or at www.seroundtable.com who today is talking on how to modify phpadsnew to do what you are looking for.
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).