Written on May 16th, 2008 at 12:05 am by Darren Rowse
How to Split Test (A/B Test) Your AdSense Ads
A couple of days ago I talked readers through some different approaches to AdSense Ad Design and how it can make a significant impact upon the earnings of your AdSense ads. At the end of the post I mentioned that one great way to work out which ad design is best for your blog is to run a split testing campaign.
Today I want to talk readers through how to do this - it’s not as complicated as you might think!
What is Split Testing?
Also sometimes called A/B testing, split testing means that you run two different versions of an AdSense ad unit on your blog so that you can see which one performs best. You serve one version of the ad to one visitor, and then another version to the next visitor.
If you do this over a large number of visitors you’ll get a bit enough sample to be able to draw some conclusions about which ad design works best in that particular ad position.
How to Run a Split Test on Your AdSense Ads
Split testing sounds complicated but it is relatively simple to set up. In short, all it really involves is setting up a couple of channels within your AdSense account so that you can track the results and then inserting a little extra code around the AdSense code in your blog’s templates. Here’s how:
1. set up two different custom channels in your AdSense account. They might be called something like ‘test A’ and ‘test B’.
2. generate two different ad units in the back end of your AdSense account. Make them identical sized formats but give them two different color palettes. Copy the codes AdSense gives you and put them into a text document - you’ll need them in a minute.
3. take the following code insert the two ad units codes that you just generated into it were it indicates:
<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>
ie - you need to replace the bolded lines with your two different AdSense codes.
4. Insert everything into your blog’s template in the appropriate spot for the ad to make it position where you want it to show.
With the above code you should now see the two different color palettes rotating on your blog. It will show one 50% of the time and the other the other 50% of impressions.
You can then log into your AdSense reports area after the script has been rotating for a while to see which one is performing best. Give it a day or two to run before you make too many changes as it can take a little while to get the ad having shown enough times to draw any solid conclusions.
Variations on the Test
You can do the same split test to work out what Ad Unit Size is converting best. The process is identical but instead of having your two ad units with different colors make the only variation their sizes (ie keep the colors the same).
You could also test any other element that you have control over. For example the different corner options, image ads vs text ads etc.
Lastly - you don’t have to make the split test a 50/50 one. You could specify for one ad unit to show up 95% of the time and the other only 5%. This means only a small number of your readers see the new ad unit (good if you’re testing something bold). To do this simply vary the “.5″ to another number. For example .9 would show one ad 90% of the time.
Final Tips
- Backup your templates before experimenting. If you mess it up somehow you can then quickly revert to your original setup.
- Make one of the ads you rotate one that you’ve been testing for a while so as to give a good baseline result to compare to.
- Don’t experiment with multiple changes at once. For example if you test ad size and colors at once you won’t be able to identify the specific element that cases the changes in ad performance.
- Once you’ve worked out which of your two ad units performs best keep testing with other options. Take your best performing one and test that against other designs to see if you can find one to better it. Once you do use that one as your baseline!


34 Responses to “How to Split Test (A/B Test) Your AdSense Ads”
Nishadha
May 16th, 2008 12:23 am
Wow great tip , But I guess to test this successfully you need to have considerable amount of traffic.
Rob Brydon
May 16th, 2008 12:24 am
Darren,
Great idea as always. It’s not every day we see you being a coder.
Thanks for the tip. When I get to the point were I have a big enough user base to test this out, I will be sure to give it a try.
Muscle Post
May 16th, 2008 12:25 am
This is awesome! I was looking for a way to do this on one of my sites, so that I didn’t have to change the ads and then wait a few days for the results, and then change them again and wait for more results. This way I can have it going on simultaneously with no additional effort or time delay.
Great post!
jhay
May 16th, 2008 12:28 am
I find it surprising that some bloggers find this neat feature a bit daunting task when it’s so easy to implement it.
Even if it requires a little extra effort when done right, it will yield valuable results that would surely improve AdSense earnings.
ShinyPlastic.com
May 16th, 2008 12:34 am
Why not call your adsense ads through a PHP include: that way you just have to change the included PHP file anytime you want to add another ad into your rotation instead of updating all your templates and rebuilding your whole site.
Richard Farrar
May 16th, 2008 12:55 am
Nice, simple explanation, definitely think I’ll give it a go on one of my sites. It’s something that’s been niggling me for a while and you’ve given me the incentive to try.
Something so simple could show immediate, quantifiable dividends. Thanks!
Mark
May 16th, 2008 1:00 am
If you want to see an example of split testing with PHP you can see my post on my blog.
I did a comparison of the 250×250 ads and the 300×250 ad blocks. I posted my results. There was a HUGE difference between the two.
Io, burattino
May 16th, 2008 1:04 am
I like your blog! You have help me to increase the users to my blog. Thank you very much and compliments! :)
Asswass
May 16th, 2008 1:23 am
A great idea would be that if you a blog or web site that has like a slideshow of photos, you could use 4 types of Ads and with every page impression the Ad would change and this would catch the readers eye because the colors would be changing.
BW
May 16th, 2008 1:30 am
This is worth looking at before checking out the rotating ads option that you mentioned the other day.
Find the best option(s) and then use that with the rotation of the ads
Bradly
May 16th, 2008 1:31 am
Great post Darren. I’ve been wanting to do this on my site for some time but haven’t gotten around to do it. Now that I have step by step instructions I have no excuse to give it a go.
@ ShinyPlastic - That seems like a good idea. How would you go about doing that?
Del Sauzo
May 16th, 2008 1:46 am
As usual I’m off to implement. The post seems to have so many ideas popping out of my brain, I’ll have to read it again. I’ll be back with my results some time. Thanks alot.
Joe
May 16th, 2008 1:54 am
Great information, Darren! I didn’t even know that you could do that. I will have to try to give it a shot at some point. Maybe test text ads against image ads..
hak
May 16th, 2008 2:18 am
Great way of doing this! I’ve been looking for a mechanism to set this up and am glad you took the time to share this script with us. Also, the series is great as I’ve about given up on AdSense and am now willing to give them another, more formal, trial.
I’ve screwed something up in that only the } else { is being displayed instead of the ads. Is it an issue with extra spaces between the “{” and the AdSense code?
Wayne Tully
May 16th, 2008 3:14 am
I like the idea of testing ads and site wide ad formats, this has certainly been a good post.
Cheers now!
Norm
May 16th, 2008 3:15 am
Darren: Where do you place adsense ads on this site? I don’t see any.
Dave
May 16th, 2008 3:20 am
As suggested, a PHP include is useful for this type of stuff.
For those not afraid to get their hands a little dirty …
adding code like this:
<?php
if (date(”w”)%2
will split test your Adsense code by DAY.
Not sure if this code will show up in the comments correctly, the important part is the “if” statement - (date(”w”)%2 < 1) - which says to show “Google Adsense #1 goes here” if today is an even numbered day, 0 (for Sunday) through 6 (for Saturday); otherwise show “Google Adsense #2 goes here”.
You can get even fancier and split by whatever time frame you want - year, month, week, hour, minute, second, etc - or a combination.
Dave
Alex
May 16th, 2008 3:44 am
I’m getting the same problem… would someone be willing to post an example (with pub ID blocked)… Thanks!
Luis Gross
May 16th, 2008 3:46 am
Great Post! I’ve been trying to figure out how to do this for weeks. I’m going to do this to practically every unit on my site. Now I can find out which are the best units for every ad placing on my blog incredibly fast.
After knowing this can you imagine putting and AdSense unit up for a week, then manually changing it. Then doing the same process over for every page, post, and every other place one might place an ad in? Omg you’ve saved me a hundred headaches. Thanks Darren, really good info.
Leszek Pawlowicz
May 16th, 2008 4:00 am
If you have the “Who Sees Ads” WordPress Plugin (and you should, it’s easily the most useful plugin I have), it’s easy to set up an A/B comparison (or just randomize ads) with the “ROTATE AD” feature. You can even combine this with some of Who Sees Ads other features, so that for example you could keep an ad static if it’s someone coming from a search engine. but rotate it if it’s a regular visitor.
http://planetozh.com/blog/my-projects/wordpress-plugin-who-sees-ads-control-adsense-display/
Herdi
May 16th, 2008 4:15 am
Great post Darren. I will try to do it on my website! Keep it coming
Sandy Naidu
May 16th, 2008 5:28 am
Thank you Darren…Love the adsense series you are writing. I haven’t yet implemented all the changes you mentioned…I will be doing that next week…This series is a valuable ‘ad sense book’.
Durkin
May 16th, 2008 7:06 am
Awesome idea, this is definitely something that I will try in the next few weeks!
Darren Rowse
May 16th, 2008 8:31 am
Norm - I don’t use AdSense on this blog. I do use it on my other ones though.
Check out this video on why it doesn’t work at ProBlogger.
Wendy
May 16th, 2008 10:18 am
Interesting concept and will definitely give it a go as soon as I fix the feedburner issues I have with my new blog.
Fighting with Cpanel etc. Newbie here.
Stak Loaded - How to make money doing nothing!
May 16th, 2008 10:34 am
Wow that’s great advice, I’ve manually tested a few different setups so this will definitely help a lot.
Lilly Mouse
May 16th, 2008 8:48 pm
That is possibly the most useful thing I’ve read in a very long time. Thanks Darren!
Rich Owings
May 16th, 2008 10:14 pm
Darren,
First of all, thanks so much for doing this. I’d love to see you put up more posts on coding.
Also, thanks for focusing on Javascript, which can be used by Typepad bloggers like me, rather than PHP.
BTW, I can’t see any ‘bolded” lines in the code in FireFox.
Finally, I’m looking for a way to rotate Amazon ads. I tried dropping them in using this approach, but it didn’t work. Anyone have any ideas?
Monica from pharmaknow
May 17th, 2008 12:23 am
Very Good post Darren. I will use this to test what of my ads is better for me. When I get some clicks :(
Bugsy
May 17th, 2008 8:47 am
Excellent! Can’t say much more than that, very practical and useful. Will put into effect immediately.
Trojan Condoms
May 21st, 2008 9:25 pm
Good point made with the article. Is there a way to target specific ads? Honestly, I have an information site about Trojan Condoms but I get ads that are half for virus trojan removal… I use Adware and am new to this. Any suggestions?
Paul
May 22nd, 2008 4:34 pm
Fantastic tip, thanks Darren!
Wang
May 25th, 2008 12:46 pm
I’m afraid. Is it against adsense TOS?
Dhimant
June 4th, 2008 3:53 pm
Great tips here! Thanks for them :-)
Leave a Reply