Google AdSense Split-Testing with PHP

Date November 12, 2007

Stumble it!

Enter your email address & Get Updates:

To succeed with Google Adsense you have test every corner, every color, every small changes and see what is the best performing way to make money online with Google Adsense. But what if you want to test 2 different ads (Color, background, size, etc..) at the same time and see how both ads will be the best? There is a small simple split testin php code that will help you make this. For those adwords advertisers who split two ads and see which one is the best, Google Adsense works the same you test 2 different ads in your site and see which ones performs better CTR.

Perhaps this is common knowledge, but if not, hopefully this will help people do some split-testing to increase AdSense revenue.

1. Set up 2 or more channels for your split tests. For example, create channels called “test1a” and “test1b”.

2. Create your two different ad units (one for each test case) and copy the AdSense code into a text document for convenience.

3. At the top of your php-enabled web page, enter the following code:
< . ?php
$testcase = rand(0,1);
? .>

*remove the dots*

4. Place the following php code where you want your ad unit for test1a to show up:
< . ?php if ($testcase == 0) {?>
– Copy and paste the AdSense code for test1a here –
< . ?php };? .>

*remove the dots*

5. Place the following php code where you want your ad unit for test1b to show up:
< . ?php if ($testcase == 1) {? .>
– Copy and paste the AdSense code for test1b here –
< . ?php };? .>

*remove the dots*

6. Sit back and wait until you’ve received enough pageviews so that the average CTR for these channels stops jumping around.

Using this approach, you can actually be running as many splits as you want. For example, if you want to test four different ad units, you would use rand(0,3) to choose a random testcase between 0,1,2,4.

Want One of the Cheapest and Affordable Hosting?



What Next?


 Subscribe To GoogleLady

 Digg It

 Save This Page

 Sphinn It

 Stumble it!

 Favorite This Post

 

Get Updates In Your Email

One Response to “Google AdSense Split-Testing with PHP”

  1. Mike Huang said:

    Thanks for the great post! I’ll be testing this myself too.

    -Mike

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>