A/B Testing: Optimize Your Ads

The problem with AdSense is people tend to ignore them. As a webmaster, you have to continually update your ad placement to prevent this “banner blindness.”

How can you tell what the best placement and ad format is? You use A/B Testing. When you A/B test, you randomly show your readers one ad or the other, and track which gets more clicks. It’s easy to do, and will improve your earnings.

First, generate to ad code snippets. Make sure both ad formats are assigned to unique (and descriptive) channels. That way you can tell how many clicks each ad block gets. For example, put your 200×200 square ad in a channel called “200×200 AB Test” and your 250×250 ad block in “250×250 AB Test.” Paste the generated codes into notepad for later use.

Now for the fun part. Use this PHP code to randomly display one ad or the other:

<?php
$randnum = rand(1, 2);
if ($randnum==1) {
?>
[Ad Code 2]
<?php
} else {
?>
[Ad Code 2]
<?php
}
?>

Just paste-in the ad codes, then put the whole thing in your blog template.

Now sit back and wait.

To see how the ads are performing, go to AdSense.com and click the Advanced Reports link. Choose an appropriate date range, check the option to show Channel Data. Check the channels you created for the A/B test and set the option to group by channel. Hit Display Report and the stats should update. Now you can easily see which ad is performing better.