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)
Looks good, to somebody who might be looking to do this as well, I saw a post by shoemoney at his blog: http://shoemoney.com/2005/09/12/code-to-rotate-easily-between-adsense-and-ypn/ dshah, do share if you can, how is YPN working for you vs. G adsense.
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.
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.
LOL its same thing. I have been thinking of how to do it but what really helped was a post on this forum
I was also newly accepted and before I could think of a way to implement it without breaking the TOSs. ShoeMoney's method works beautifully. http://shoemoney.com/2005/09/12/code-to-rotate-easily-between-adsense-and-ypn/ THANKS SHOE J
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.
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)
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
I just spelled it out for folks that don't have the coding experience. I'm sure both will be helpful.
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.