Give me 31 Days and I’ll Give You a Better Blog… Guaranteed

Check out 31 Days to Build a Better Blog

Give me 31 Days and I’ll Give You a Better Blog

Check it out

A Practical Podcast… to Help You Build a Better Blog

The ProBlogger Podcast

A Practical Podcast…

FREE Problogging tips delivered to your inbox  

AdSense Explain A/B Testing

Posted By Darren Rowse 11th of August 2006 Adsense 0 Comments

The Official AdSense blog has posted a short tutorial on how to implement an A/B Test with your AdSense ads.

An A/B test sets up two different types of AdSense ads that rotate on your page in different configurations so that you can test which one works best for your site.

For example you could set it to track how two different color schemes perform in the one ad position or how different sized ad units do.

The first thing to do when setting up such a test is to set up two channels to track your results. Then use the javascript code below to rotate the ads.

Here’s the javascript code that they suggest you can use to run an A/B Test with your AdSense:

<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 type=”text/javascript” src=””></script>

Replace “//your first ad unit goes here” with your ad code inside the first set of <script></script> tags.

It’s an experiment that is well worthwhile and it’s nice to see AdSense are making it possible. I’m sure however that there would be a more automated way to do it. For example they do allow publishers to rotate up to four color schemes in their ads at present – it’d be great if we could assign a different channel code to each color scheme to track it – in effect this could be a similar test.

About Darren Rowse
Darren Rowse is the founder and editor of ProBlogger Blog Tips and Digital Photography School. Learn more about him here and connect with him on Twitter, Facebook, Google+ and LinkedIn.
  • I’m not having any luck with adsense, I don’t think it has anything to do with the colors. I guess it’s probably better to go with referral programs and sell real products.

  • This is fantastic news and I am sure that you could tweak that code to allow a few more adsense options at the same time.

    I have noticed in the past that when I change my adsense setup my CTR immediately shoots up and then goes back down after a couple of days, I am sure that this is regular readers just noiticing the ads and not being ad blinded for a couple of days until they adjust.

  • I hadn’t heard about this until your post. Also, your steps are short and simple. Thanks for this great advice!

  • And yes don’t expect “Lots of money” just afer implementing this tweak.

    Adsense is all about “Traffic”.Then definately you can tweak that Traffic to pay your expenses.

  • Correct me if I am wrong but the code they give there is in fact more meant for static pages. In databased websites you can easily set adsense blocks this way that they rotate easily. For Pmachine for example it suffices to add an extra item (in this case an adsense code with a different channel) to your pblock and have it on automatic rotation. Or you could start adding the code in above in just one Pblock.

    I will have a look at this to see what it does, could be interesting to see :)

  • Nice, will definitely give this a try.

  • thanks for the script and tips :)

    but what is this mean?

    sorry, i dont know what is it.

  • Many bloggers still face problems about putting codes as they do not know about it much. Darren, if you come accross any video that describes this process, please post about it here. I think that Google should make more templates that would include Adsense codes directly so that we dont have to put codes but if we select a template the Adsense will come automatically too.

  • Thats cool that they are giving us that feature to take advantage of. I don’t know of a good alternative for my ads at this point but I will keep it in mind.

  • Thanks for the heads up.

    For those saying that Adsense is not working for them ……… yes, if your site is not popular and it is not targeted to the audience in a specific field, your adsense ads will just take space.

    On the other hand, if your site is popular, gives great content, speaks to your target audience and unique, you will make money.

    From what I heard people make around $1,000 /month with a pretty good site. I am sure this website makes more as it has more visitors and let’s see ………. 7,900 READERS!

  • This is a great tip. Does it really make that much of a difference if you’re only changing the color scheme of the ads, though?

  • Adsense and everyone else makes a lot of noise about A/B testing, but my experience is that in reality it is far more difficult than they make it seem.

    There’s so much you can’t control about the ads themselves that I think it’s almost pointless. A new advertiser might pop into the mix and bump your stats – nothing to do with anything you did. For whatever reason an old ad that attracted nothing in the past suddenly becomes interesting to your audience.. that kind of thing.

    I do dabble with my Adsense now and then just for the heck of it. I track which ad positions contribute what, and those vary pretty widely all by themselves – too widely for A/B testing, in fact. I’d need a very long test to smooth all that out, and too many other things would change. I don’t think this is really quantifiable because of the uncontrolled variables.

    Certainly if what you are doing is “all wrong”, A/B testing will find that. But beyond that, I don’t see much value. If you are floating around a few hundred clicks or less per day, a 1% gain might be less than $5.00 per month improvement in earnings – not worth spending much effort on for most of us.

  • New information about adsense..I did’nt know until you post it. hopefully it can help adsense publisher..

  • I just implemented something similiar with my blog, but I used PHP in my wordpress template file for my current layout to rotate between adsense and the omakase ads from amazon.

    I think the omakase part needs some layout tweaking to make it look better. but I think this is cool because I learned more about PHP in the process, and I can have both adsense and omakase without them EVER being on the page at the same time.


  • I have always been curious. I am currently part of a mildly successful blog but when you say, “get paid for doing it”, what are we talking here?