Mortgages - Cheap Flights - Consolidation Loan - Loans - Personal Loans

PDA

View Full Version : How do I test YPN along with existing Adsense?


LeeD
Sep 8th 2005, 9:03 am
I need to know how to run Adsense 50% and YPN 50%. Anyone know what code to use to accomplish this?

Thanks!

dshah
Sep 8th 2005, 9:33 am
I am planning to write some code for this myself, if I can't find it on internet :)

exaro
Sep 8th 2005, 10:52 am
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.

Willy
Sep 8th 2005, 12:19 pm
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');

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 (http://php.net/manual/en/function.rand.php).

UndiesHosting
Sep 8th 2005, 12:27 pm
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.

Jenstar
Sep 8th 2005, 4:44 pm
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.

alph
Sep 8th 2005, 7:28 pm
the page of code still contains both instances so its technically violating TOS.

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.

Nintendo
Sep 8th 2005, 7:55 pm
the page of code still contains both instances so its technically violating TOS.

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!!!

exam
Sep 8th 2005, 8:04 pm
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.
If the rotation is done on the server side, there's no TOS violation :)

Jenstar
Sep 8th 2005, 8:14 pm
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 :)

tresman
Sep 8th 2005, 8:44 pm
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.

dshah
Sep 12th 2005, 1:00 pm
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.

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).