setting up a A/B split test with PHP

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
hi all,

I would like to test different page layout / creative elements of a
website using a A/B/C split run test.
How could I set it up using php?
Basically, I would like to  include a different html code for different
visitors and see which gets the best click-through, conversions  etc.
The stats tracking part it's not a problem , it's just how could I show
the first user the A version, then to the second the B version and then
the C one to the third and so on with the A version to the fourth etc.

How could it be the php script ? should I take note of the number of
visitors in a database and then  doing some maths? but how ?

Please point me in the right direction

Thanks in advance

Re: setting up a A/B split test with PHP

Look into sessions. In the session variable, you can store the chosen
version, so that you can present the same version with the next hit.

Re: setting up a A/B split test with PHP

Quoted text here. Click to load it

Don't you mean the present next version with the next hit?

What about using the Modulus operator?

Re: setting up a A/B split test with PHP

When a new user enters your site, you can give him a random version.
However, you do not want that the version changes while the user is
visiting your site. So if a user clicks a link, that next page has to
be loaded with the same version. This can be accomplished with sessions
or cookies.

Re: setting up a A/B split test with PHP

Sjoerd wrote:
Quoted text here. Click to load it

thanks guys .

however, I am afraid sessions is not what I am looking for.
I mean, keeping the same version during the visit of the same user is
not my primary goal, the split run testing is needed to know which
different creative/ layout option ( ie some copy in the text , the
position of a form etc. ) is more efficient.

So the test is usually performed on single pages, often homepages or,
better, landing pages.

What is really important is that if for instance I have to test 3
different version of something, each option must have the same number
of impressions in order to have  reliable stats to anlayze ( so 33,3%
of visitors must have seen one of the 3 different pages).

I realized that I should have a look at banner rotation management
scripts without using any random function because the core of my script
must be an equal number of views for each version.

I had no time to search properlly the web for those scripts yet but the
only one I have saw used a database table to know each time which
version of the banner has to be included in the page following an array

Anyway , any suggestion is always welcome


Re: setting up a A/B split test with PHP

fill in the blanks...
$i = "select count from abcounter"...

if ($i%3 == 0){$page = "1.php";}
if ($i%3 == 1){$page = "2.php";}
if ($i%3 == 2){$page = "3.php";}

"update abcounter set count = count+1"...

header("Location: $page");

Site Timeline