AdSense tip: randomizing ads

No, this isn’t my “brilliant idea” – Chris Garrett of Performancing mentioned it first. But, while he gives a PHP example on how to get a simple random number, I’ll go a bit further…

The idea, as Chris says, is to randomize a particular AdSense ad (changing formats, colors, etc.), and have different channels for each version. Doing it, you can easily learn what works best, and what doesn’t, instead of having to wait for a couple of days while you test each format. This also allows you to focus on a single change – one ad – without being affected by other factors, such as the time, the day of the week, and so on – as at any day, any time, every single ad version has a chance of appearing.

This is just an example in PHP, which works for WordPress blogs, for instance. There are, of course, many other ways of doing this.

1- pick a particular ad. Replace that ad’s AdSense code with <?php include 'adsense-ad.php'; ?>.

2- on the WordPress directory for the theme you’re using, create a file adsense-ad.php with the following:

<?php
  $i = rand (1,8);
  $script = "adsense-ad" . $i . ".php";
  include $script;
?>

Replace the “8″ with the number of ad versions you’re going to test.

3- go to the AdSense options, and generate code for the first version of the ad. Remember to set a unique channel. Save it as another file, in the same directory, named adsense-ad1.php (note the “1″, it’s not the same file as before – that one had no number).

4- repeat the previous step for the other ad versions (changing the channel, and the digit in the file name).

Easy, wasn’t it? :)

Related posts:

  1. Blogging tips #16: Making money from your blog – AdSense: which ads? And where?
  2. AdSense tip: Using AdWords to find keywords
  3. Eric Giguere: using different directories to test AdSense ads’ relevance
  4. Blogging tips #14: Making money from your blog – AdSense: getting relevant ads
  5. Blogging and AdSense quick tip

9 Responses to “AdSense tip: randomizing ads”

  1. aa@aa.ss says:

    its against the tos to modify generated code

  2. I’m not doing that. The code is Google’s; I go to the AdSense administration page, ask for code for, say, 8 different ads, and pick one of them randomly. Nothing is modified.

  3. Joe Anderson says:

    Yeah, technically he’s not modifying generated code. :P

  4. aa says:

    well lawfully he is. lol im not sure.. heck all things have risk.

  5. No, I’m not. :) If I take 8 photographs of someone, and pick one of them at random, am I modifying the photographs?

  6. Roxxy says:

    Thanks for the tips

  7. [...] Some time ago, I wrote about a way to randomize ads; that is, in a particular position, show one of a number of different ads. With AdSense channels, you can use it to find out which ads (formats, colors, etc.) work better in a particular position. [...]

  8. [...] PHP or codes HOW TO: Create intelligent blog ads Split testing Adsense Adsense tip: randomizing ads Trying to boost Google Firefox referals program earnings How to Get Immediate, Top Placement With Search Engines: A Pay-Per-Click Overview [...]

  9. PaulsQuiz says:

    Wonderful idea!! Thanks for your help with the PHP. I have just taken it one step further and put adsense code in one php file, bitvertiser in another and clickbank ads in a further one – great way of rotating between the three without filling the page with ads. This makes each page load look slightly different and hence my visitors don’t get quite so ad-blind!
    Thanks again,

Leave a Reply

Notify me of followup comments via e-mail. You can also subscribe without commenting.


Creative Commons Attribution-NonCommercial-NoDerivs 2.5 Portugal
This work by Pedro Timóteo is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 2.5 Portugal.