View Full Version : A/B Splitting script

11-30-2007, 04:53 PM

I need help testing out a new sales page on my website, I've looked all over but I cant find an easy to use free script that will split all traffic coming into my site sending half to "http://myurl.com/1/" and the other half to "http://myurl.com/2/"

I've found lots of people on forums and messageboards looking for the same kind of thing but there has been no definitive answer.

The only computer language I really understand is HTML so I'd like something I could just copy and paste into my root directory, add Url A and Url B so that it will split my traffic.

If anybody knows of a script that could do this or a tutorial that could show me how that would be Great.



11-30-2007, 05:04 PM
Do you use PHP?

If so... try this:

$num = rand(1, 2);
if($num == 2){
header("Location: http://www.example.com/2/");
header("Location: http://www.example.com/1/");

11-30-2007, 05:04 PM
And by the way, I believe Google offers a feature for this automatically for adwords advertisers.

11-30-2007, 05:22 PM
Thanks for the quick replies:) ,

thanks Chris for the script I'll try that out now, This is for my search engine site. I send people from adwords to a separate domain.

I'll let you know how it goes,


11-30-2007, 05:28 PM
Yep that worked perfectly

Thanks again :)


11-30-2007, 05:51 PM
It could of course easily be made fancier. What you could do is turn the "header" lines into includes to mask the URL, and so include the files instead of redirecting to them. Then I'd also set a cookie to make sure that if one person revisits they always get the same landing page.