The ABC's of A/B Split Testing

Posted on March 2, 2007 11:23 AM by Joel Comm



Share

Google is very protective of its AdSense code. Start changing bits here and there and you can't expect to keep your account open for very long.

But there's one exception to that rule and it's a very important one. You can put this code on your Web pages:

<script type="text/javascript">
    var random_number = Math.random();
    if (random_number < .5){
        //your first ad unit code goes here
    } else {
        //your second ad unit code goes here
    }
</script>
<script type="text/javascript"     src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>

replacing the lines after the // with the codes for two different ad units. This is all approved and above board. Google writes about it on its AdSense blog.

What will that code do?

It will swap the two units randomly so that each unit is shown for half the time on your Web page. Put two different channel codes in each of those units and make sure that only one characteristic is different in each of the units. After a week or so of checking your channels, you'll be able to see which unit brings the best results.

Google calls it A/B testing and it's a great way to choose between two different criteria, whether that's two choices of unit size, two choices of font color, two choices of position or whatever it may be.

But that's also why it's important to have a test page. You don't want to be testing different options across your entire site. If your original choice was the best, you'll lower your income for the entire site. Use A/B testing on one page, monitor the results, then roll out the winner across the rest of your pages. It's a fast way to optimize your site.

See Also

Google Adsense Secrets - Feb 12, 2005
Kontera - Sep 21, 2005
Can You Digg It - Jan 29, 2008

3 Comments

Fantastic!
Where was you get the code from?
Amazing, Brilliant...
Best Affiliate Man #1 In the world!

Great post! I must have missed this one. I have you on my blog reader to read your updates, just need to go through your archives more thoroughly. Your blog is one of my favorites!

Be careful when using such kind of code for A/B split testing!

It's based on random code, so there's no guarantee "that each unit is shown for half the time"! As you don't control the process (it's random) it can show 90% of the time one unit over the other and it will give you wrong results!

When using the above code check how many times each unit was shown and clicked and do your math to get correct results.

The article Joel referred is at
http://adsense.blogspot.com/2006/08/abcs-of-ab-testing.html
and there are some important notes that you must also follow when running an A/B test.

Leave a comment

Keep up with Joel, Free!

Subscribe to JoelComm.com via RSS

Subscribe to Joel's YouTube Channel

 

Or, subscribe via email:

Name:
Email:


Joel's Photo Stream

Hey!  No riding on the grass! #sculpture #TagsForLikes #art #tweegram #photooftheday #20likes #amazing #followme #follow4follow #like4like #look #instalike #igers #picoftheday #bike #instadaily #instafollow #like #girl #iphoneonly #instagood #bestoftheday #instacool #instago #all_shots #follow #webstagram #colorful #style #swag
Playing Trifecta with @zachcomm . Got it from a Kickstarter campaign.  Maybe good for little kids, but not so much for adults #kickstarter #cards #game
It was THIS big! #kitten #funny

If you are going to have jerky, wouldn't you prefer it to be perky? #jerky #snack #gross
Beautimous sunset tonight! #colorado #sunset
These would be flowers.  Duh.  #love #TagsForLikes #TFLers #tweegram #photooftheday #20likes #amazing #followme #follow4follow #like4like #look #instalike #igers #picoftheday #food #instadaily #instafollow #like #girl #iphoneonly #instagood #bestoftheday #instacool #instago #all_shots #follow #webstagram #colorful #style #flowers

It's Mr. Bacon! #bacon #toy #silly
Ah, the good old days #beatles #record #music
Beautiful dusk sky in Fort Collins #love #TagsForLikes #TFLers #tweegram #photooftheday #20likes #amazing #followme #colorado  #look #instalike #igers #picoftheday #mountains #instadaily #instafollow #like #nature #iphoneonly #instagood #bestoftheday #instacool #instago #hiking #follow #webstagram #colorful #beautiful #outdoors

With @etherealdragon at Ignite Fort Collins where he will be delivering his first talk!  Www.ignitefortcollins.com
Very clear day in Northern Colorado.  Looks like at least some of the wildfires are under control #mountains #beautiful #sky
Smoke from Colorado wildfires obscuring the mountains.  Praying for the safety of people in the homes in harms' way #TagsForLikes #TFLers #tweegram #photooftheday #colorado #amazing #followme #colorado #wildfire #look #instalike #igers #picoftheday #mountains #instadaily #instafollow #like #nature #iphoneonly #instagood #bestoftheday #instacool #instago #hiking #follow #webstagram #fire #beautiful #outdoors

This burger brought to you by the letter H #food #hburger #omnomnom
Very cool second-hand bookstore just opened down the street.  They buy and sell books, DVDs, LPs, comics, video games, electronics and more.  So happy to have them in the neighborhood!  Thought this wall display was clever. #books #2ndandcharles #buy #sell
It would be absolutely perfect were it not for the fires taking place in the mountains.  Still, it's gorgeous. #love #TagsForLikes #TFLers #tweegram #photooftheday #20likes #amazing #followme #colorado #boulder #look #instalike #igers #picoftheday #mountains #instadaily #instafollow #like #nature #iphoneonly #instagood #bestoftheday #instacool #instago #hiking #follow #fire #colorful #beautiful #outdoors

See more photos

FTC Disclaimer: Posts written before December 1st, 2009 may include endorsements of products or services that include a material connection to the author. Readers should assume a material connection for any product or service endorsed prior to December 1, 2009.