views:

45

answers:

5

I want to create a way to test different layouts on a page to see which get more conversions.

For example. If I have 2 versions of a page and I send 50% to page A and 50% to page B and see which one converts more sales.

So I am thinking maybe use .htaccess to rewrite half to page A and the other half to page B.

But how can I do that with .htaccess is there a way? do I need to use PHP instead to do this?

Also if there is a better way to do this, or any cautions I should be aware of, please let me know.

+1  A: 

I would do that using php, following way: After the user got to the default php file, i would store his browser data in a db table, and the active layout identifier (filename, row id, etc...). Everytime the server gets a request from this user, it shows the page, mapped to him.

But! If you have two independent pages, i would only store how many people visited site one, and site two, and redirect them to page A, and to page B by a 50% division.

Nort
A: 

I think php will be very useful. For example, you can use rand or push a variable in a file :

$int = file_get_contents('var');
if ($int) {
  $int++;
} else{
  $int = 1;
}

if (($int % 2) == 0) {
  header('Location: url1);
} else {
  header('Location: url2);
}
file_put_contents ('var', $int);

With apache, you have to setup a load balancer : http://httpd.apache.org/docs/2.1/mod/mod_proxy_balancer.html

Brice Favre
+2  A: 

Lots of ways to deal with it on your own code. If however you're already using Google Analytics and don't care to use javascript for the test, spare yourself a lot of trouble and look at http://www.google.com/websiteoptimizer/index.html

Wrikken
+1 for Website optimizer, I am reading the documentation on that now.
John Isaacks
A: 

I would use php personally. Then you can save which page layout you chose for them as a session var making it easy to load that layout on each page refresh. You would probably also want to save into the database with their username (if they login) and if they visit later show them the same layout.

Jonathan Kuhn
A: 

If you've got a supported database and are using PHP 5.2 or later, you can use a free split testing library called phpScenario, found at www.phpscenario.org

Then you write more or less something like this:

require_once 'scenario_setup.php'; // you write this
if (Scenario::IsControl('experimentname')) {
   // read and output version 1
} else {
   // read and output version 2
}

Then when you get to your conversion point (say, sign up):

require_once 'scenario_setup.php'; // same
Scenario::Complete('experimentname');

And to view the stats (probably on your admin page):

require_once 'scenario_setup.php'; // yup
Scenario::RenderXml('experimentname');
James