Split test your Adsense ads

June 20, 2009 | By Naman Bagga | Filed in: Blogging, Tech Talk, Web D.

Split testing (also known as A/B testing) your ads is a great way to determine which ad format is best for your website. Regular visitors of my blog would’ve noticed (if you don’t use ABP) that the ad at the top of the sidebar is sometimes a large ractangle (336×280) and sometimes a rectangle (300×250). Well, this is a part of a split test I’ve been conducting for some time. This post will explain how you can split test your Adsense ads.

First of all you need to create two similar Adsense units like a 338×280 and a 300×250 unit or a 160×90 or a 160×600 unit and a 120×600 unit. You may also create two units of the same size with a different layout or format. This depends on what aspect you want to test. Create a separate channel for both these units for the purpose of tracking their individual stats.

Now comes the main part, implementing the split test code. There are many methods to implement the split test code. All of these use conditional statements along with some function to generate a random number. I’ll give two popular methods to split test Adsense ads. Both more or less work on the same principle.

The Javascript Method

This is the basic syntax of the split test using Javascript-

<script type=”text/javascript”>
var random_number = Math.random();
if (random_number < .5){
<! Add first ad code below>

else {

<! Add second ad code here>

<script type=”text/javascript” src=”http://pagead2.googlesyndication.com/pagead/show_ads.js”></script>

Note that it is against the Adsense program policies to edit the ad code. I thought this method was against the Adsense policies when I started writing this post. But then I came across this post on the Adsense blog which mentions that they talked to their policy folks and they’ve given permission to publishers to edit the ad code for A/B testing purposes.

As I’ve mentioned, I used to think that the Javascript method was against the Adsense program policies so I decided to use some other method. This method was the PHP method.

The PHP Method

This method doesn’t insert any bit of code between the ad code. So naturally there is no question of it being against the Adsense program policy. Note that your server needs to support PHP for this method to work. If you are using WordPress, your host definitely supports PHP(duh!). This is the code for the split test using PHP

<?php $splitIt = rand()&1; echo “<!– $splitIt –>”; ?>
<?php if ($splitIt == 0) { ?>

<! Insert 1st ad code>

<?php } ?>

<?php if ($splitIt == 1) { ?>

<! Insert 2nd ad code>

<?php } ?>

Using both these methods both the ads will show up almost 50% of the times the ad is shown. You can now compare the performance of both the ad units and decide which one you want to use. You can also further split test the better performing ad with another ad.

My Results

I’ve been conducting a split test between 338×280 and 300×250 rectangles for quite some time now. The result of the test was mixed. The 300×250 unit and 338×280 unit both have good CTRs but the 300×250 unit has a slightly better CTR. But what attracts me towards the 338×280 unit is that at a decent CTR it gives a much higher CPC which effectively leads to better earnings than the 300×250 unit. I need some more time before which I can decide which size is the best for my blog.

Note that different websites show different results on split testing. The best way to know which format is the best for your site is to split test ad units. I’ll update this post once I get a concrete result of my split testing experiment.

5 comments on “Split test your Adsense ads

    • Здраствуйте!У меня есть новость магазину он-лайн Тогда читайте новость – белье нижнее и магазин интернет платья … Всем пока рад был сообщить… :::::::::::: – kamagra rx review or – cialis and kamagra together , – kamagra jellies from abroad !!!!

    • Fabulous bird collage card Yvonne..I love the colours and the pretty ribbon. Congratulations on the DT, I look forward to seeing your "makes" Thank you for joining in at MMMSuzi B xx

    • Phil,rien – ni personne – ne fêlera l’immense amitié et le respect que je porte à un ami : Jacques Barozzi. C’est un homme de grande culture et de grande élégance. Sa vie personnelle lui appartient et ce que je lis de lui, au fil des commentaires, est souvent parole de trublion, une provocation pour ébranler les consciences. Toutes les fontaines sont d’eau claire avec lui.Amicalement

Leave a Reply

Your email address will not be published. Required fields are marked *