Here’s a code I use over on ListPlaybook.com to rotate 4 different landing pages.
It’s much faster than starting and stopping Google’s tool every time I want to make a small change or add another page.
All you have to do is put this code in your index.php and then all the links in here will rotate randomly and show the visitor those other pages on a random rotation. You can have more or less than 4, just add or remove another as necessary.
Here’s the code (don’t forget to wrap it in PHP tags):
$sites = array(
"http://listplaybook.com/promo1/",
"http://listplaybook.com/promo2/",
"http://listplaybook.com/promo3/",
"http://listplaybook.com/promo4/");
$randomSite = array_rand(array_flip($sites), 1);
header("Location: $randomSite");
This will make index.php rotate to promo1/, promo2/, promo3/, and promo4/ on a random rotation (which at the end of the day is evenly rotated.)








Hi Brian – thanks for the code. Quick question: is the PHP-driven result adjusted to be “more truly” random? I recall that sometimes randomizers must be compensated for pattern behavior… should we be multiplying the initial result by a time factor to get better insight into which landing page is most effective? Apologies if I am overcomplicating this…
At the end of the average day it’s approximately an even rotation, so I wouldn’t worry about it. Sometimes it can be +2 or -2 for one of the split tests but it’s never anything drastically different.
There are certainly ways to be more random but it’s probably nothing you’re going to care about until you are doing 3 million uniques a day in a split test rotation.
Awesome. I use the one that the guys at 202 showed, but this might be easier to use.
I use a very similar script to test Adsense ads. Anyone interested can get the code here.
http://www.brentcrouch.com/2009/11/30/free-code-for-testing-adsense-color-size-and-placement/
I have another version of the code that actually cookies the visitor to make sure they are shown the same style of ads throughout the site. I’ve been able to increase my eCPM by 150% on the site I mentioned in the post.
Nice!