How to Perform A/B Testing of Adsense Ads for Higher CTR

A/B testing is the best way to determine which Google Adsense format will get the highest CTR and help you make money online. Most webmasters and bloggers try standard configurations and limit their site’s earning potential. So how to perform A/B testing?

A/B Testing of Google Adsense Ads

You have noticed we run a 336×280 ad unit on every article. Now suppose we want to test different link colors to see which ad format works best – here is how to do it.

  1. Create  first ad unit of 336×280 with blue links.
  2. Assign it with custom channel, lets say ‘blue links’
  3. Create second ad unit of 336×280 with green links.
  4. Assign it with custom channel, lets say ‘green links’
  5. Use javascript code to rotate the ad unit to display alternate ads with blue and then green links and so on.
    <script type="text/javascript">
    var random_number = Math.random();
    if (random_number < .5){
    // first ad unit code
    } else {
    // second ad unit code
    }
    </script>
    <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
  6. Place the javascript code where you originally had place your ads.

Correct Code Use –  Remember that since the javascript code above already has the script tags, you need not cut paste the whole Adsense code, but only the part between the script tags. So this how the code will look like.

<script type="text/javascript">
var random_number = Math.random();
if (random_number < .5){
 <!--
 google_ad_client = "pub-99999999999999";
 google_ad_slot = "12345";
 google_ad_width = 336;
 google_ad_height = 280;
 //-->
} else {
 <!--
 google_ad_client = "pub-99999999999999";
 google_ad_slot = "123456789";
 google_ad_width = 336;
 google_ad_height = 280; 
 //-->
}
</script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>

This is a very nice trick suggested by Adsense team itself and works very well – which means you need not worry about editing the Adsense code for A/B testing purposes only (which otherwise is not allowed as per Adsense guidelines).

Compare the channel reports in Adsense Reports after a week (it takes time to get useful results!) and see which channel has better CTR and  then use those links. You can modify the code and keep optimizing – change a new parameter now, like text color etc. and keep using this technique for highest CTR possible.

We got a higher CTR by this technique. Tell us you got better results…

Share with friends

About the Author: P Chandra is editor of QOT, one of India's earliest tech bloggers since 2004. A tech enthusiast with expertise in coding, WordPress, web tools, SEO and DIY hacks.