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:






















its against the tos to modify generated code
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.
Yeah, technically he’s not modifying generated code.
well lawfully he is. lol im not sure.. heck all things have risk.
No, I’m not.
If I take 8 photographs of someone, and pick one of them at random, am I modifying the photographs?
Thanks for the tips
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,