Increase Adsense Revenue with A/B Split Testing

My Adsense earnings have been fairly flat lately, and I’ve been wondering what there is I can do to improve them. I’ve read again and again about the need to test different ad variations in order to figure out which performs the best for me. I’ve always stumbled though when it came to actually doing so as it seemed like such a large, labor intensive process.

Reasoning that someone, somewhere must have figured out an approach to solve this problem, I started hunting for a solution. I stumbled upon one on Google’s own Adsense site that is so simple that I actually laughed when I first read it. It took me all of about 30 minutes to implement it for the first time, and I can’t imagine it will take me more than 5 minutes per test going forward.

What is A/B Split Testing?

The concept, one known for years in formal market research, is known as A/B Split Testing. By testing two things, one called A and one called B, against each other, you can determine which one performs better. Simple, of course, but the trick is that for it to be reliable, you need to change only one thing at a time between A and B, and the changes need to be tested simultaneously, so that external factors like time of day or day of week don’t influence the results.

For example, you might have two ad units that are identical except that one uses a blue background and the other a white background. To use A/B Split Testing to determine which one makes more money, you would randomly alternate between the two ad variations as they are presented to your visitors. After showing the two versions many, many times, and measuring your earnings, you could feel confident about which add to keep.

Javascript to the Rescue

OK, without further ado, here’s the code:

<script type="text/javascript">
    var random_number = Math.random();
    if (random_number < .5){
			google_ad_client = "pub-XXX";
			google_ad_slot = "XXX";
			google_ad_width = XXX;
			google_ad_height = XXX;
    } else {
			google_ad_client = "pub-YYY";
			google_ad_slot = "YYY";
			google_ad_width = YYY;
			google_ad_height = YYY;
<script type="text/javascript" src=""></script>

Now if you have some programming language experience, this is probably speaking to you rather nicely. If not, it might take some explanation. The premise is incredibly simple. It’s just a bit of Javascript that you can use to randomly alternate between two different ads. Wherever you would normally insert a standard Adsense code block, you would use this code instead, with a few minor modifications. The only thing that has to be changed is to replace the “first” and “second” code blocks with your real Adsense code representing the two ads you want to test. Neat, huh?

Track the Results with Custom Channels

While the Javascript will rotate your ads nicely, to view the results of the test will require a few more steps:

  1. Create the ads you want to test within Adsense. I’m sure you’ve already know how to do this, but I include the step for completeness. Give them names that clearly describe their attributes and how they differ, such as TopBannerWithBorder and TopBannerWithoutBorder.
  2. Create two custom channels, one for each ad that your are testing. Again, make sure to use descriptive names so that you won’t have to try to remember what they represent. It’s not a problem to reuse the names you used for the ads. That’s what I do.
  3. Assign each ad to its own, separate channel.

Why use channels in this way? Due to a limitation of Google’s Adsense reporting, you can’t report on ads directly. You can, however, report on channels. By creating a custom channel for each ad, you can get around this limitation.

Wait a Week and Run a Custom Report

It’s important to run the test long enough to have confidence in its conclusion. How long is long enough? Well, you could delve into statistics and come up with a number of different answers, but for me I’d like to see a few thousand impressions if possible, spread out over at least a 24 hour period. I usually just let a test run for a week, and then check back to see what happened.

To actually see the results of the test, you have to create a custom report within Google’s Adsense “Advanced Reports” module. The process is simple:

  1. Choose a date range that spans the period of your test.
  2. Under the Show heading, select Channel data, and then select the two channels that contain the two ads in your test.
  3. Under the Group by heading, select Channel.
  4. Under Choose Units heading, select Combined. Doing so is necessary if you are testing standard ad units against text link units.

Click that nice big Display Report button, wait a few seconds, and view your results. As you now know for sure which ad performed better, the next step is to drop the losing ad, and create a new one to test against the winner. You can continue to test again and again until you find just the right combination to ensure that you are doing all you can to maximize your Adsense earnings.