I want to rotate between two different AdSense ad blocks for testing purposes. I'm trying to think of the best way to do it. I could search Google for an ad rotation script, but I don't want anything big, bulky or complex. I don't need anything fancy. I can probably do it myself with PHP. I just want to think of the simplest way. What do you think? What is the simplest way to rotate ads? They don't necessarily need to alternate for every page view. They could alternate every 5 or 10 minutes, or something like that. It doesn't matter. I just want to see which ads perform best. Thanks, Scott
Thanks for the tip, but it's not a Wordpress site. It's a phpBB forum and a hand-coded PHP site. I think the simplest way might just be to do it by the time. For example, I could have it so if the hour is an even number than it displays the first ad code, and if the hour is an odd number it displays the second ad code.
If you looking for a PRO solution then try Openads, you can rotate based on country/IP and whatever you can dream off.
switch(rand(0, 1)) { case 0: echo "<code for ad A>"; break; case 1: echo "<code for ad B>"; break; } PHP: By adjusting the numbers you can control exactly the ratios at which each ad is delivered. It's also more straightforward to implement and adjust than some scheme involving the time of day.