Forum Moderators: DixonJones

Message Too Old, No Replies

Simple split testing script

Split testing

         

strive4impact

4:07 am on Oct 11, 2005 (gmt 0)

10+ Year Member



I have been hunting all over to try to find some help with this topic.

Is there a simple line of code that I can put on a page that will load page A the first time someone views it, and load page B the second time someone views it, and load page A the third time someone views it, and load page B the fourth time someone uses it, and load page A the fifth, Page B the sixth, and so on?

Isn't there some simple HTML for this? Or a basic cut and past JavaScript?

I haven't found it anywhere... lots of pay services. I have an ebook that I want to split test two pages, to see which gets higher return rates, but everything I've found so far has been pay for services, or not very helpful.

Any responses much appreciated!

Dijkgraaf

10:07 pm on Oct 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



By the sound of it you will want to use some sort of scripting language (asp, php, perl etc.) to achieve this sort of effect. Do you have access to any of those? If so it would be a lot simpler.

The best you could probably achieve with JavaScript it for it to throw a random number so that you get a 50%/50% split, and that the JavaScript then writes the appropriate contents with document.write() statements. I wouldn't recomend this approach.

Also when you say "someone" do you mean the same person revisiting the page, or anyone?

strive4impact

5:28 am on Oct 12, 2005 (gmt 0)

10+ Year Member



Just whenever the page is loaded. I just want to have the ability to test two pages to see which one sells better.

What would a Javascript look like for this? I can use the other programming languages with my host, but I'm not good with them personally at present.

Why wouldn't you recommend a document.write code?

Dijkgraaf

10:36 pm on Oct 12, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well for starters it wouldn't work for anything that doesn't run JavaScript, which would be various browsers or locked a down IE and also search engine bots.

It would also be harder code to maintain and debug.
Javascript would look something like.

<script type="text/javascript">
...
if ( parameter == 1) {
document.write('html code 1a');
document.write('html code 1b');
document.write( html code 1c);
} else {
document.write('html code 2a');
document.write('html code 2b');
document.write('html code 2c');

}

</script>

Whereas in PHP for example you could just have

<? if ( $paramater == 1 ) {?>
html code 1 here
<? } else {?>
html code 2 here
<? } ?>