Quick and Easy A/B Testing with Bit.ly and PHP

Right before the holiday break, several of us in the marketing group were reviewing a few banner designs for our homepage centerpiece. Both were good, and we couldn’t decide which one we liked better.

So, we let the people decide.

Enter quick and dirty A/B testing. There are many tools to help you do this, but since this was one of our first forays into testing content and calls to action like this, I didn’t need a complete soup-to-nuts solution, I just needed to see which banner was getting more clicks.

Thanks to Bit.ly and a few lines of PHP, we’ve been running a simple A/B test over the break. If you create an free account with Bit.ly, you can get very nice anayltics about your shortened links, get QR codes and more. It’s also nice if you use a tool like TweetDeck or WordPress, you can put in your Bit.ly info and it will track your shortened links for you.

I set up 2 Bit.ly URLs and with a few lines of PHP, which look like this:

<?php
	$whichcard = mt_rand(1,3);

		if($whichcard == 1){
			$graphic = "image.jpg";
			$link = "http://bit.ly/URl1";
		}else{
			$graphic = "image2.png";
			$link = "http://bit.ly/URL2";
		}

?>

Very simple code – it’s basically just grabbing a random number each time the page is loaded and displaying the corresponding image and link. Seriously, that’s it. Over the break, I’d log into Bit.ly and see how it was going.

I think it’s pretty easy to see which banner people were responding to.

tatersucess.png

Is this type of test giving perfect results? No. By randomizing which banner is being shown, it may be giving one banner more views than the other. But it’s all good.

For our first time dipping our toes into the pool, I think it’s worked out pretty well and we’ll definitely be using it more in the future.