» March 15, 2007 in
Split testing your adsense is the process of taking two different ads and presenting them both randomly to you website visitors.The goal of split testing is to determine which ad receives the highest number of clicks or makes you the most money.
No need for guessing with your adsense anymore, use split testing, here's how:
Caution: Back up any file before modifying it.
Step 1 - Replace your current adsense code in your blog template or website with the following code
<?php
$temp= rand(0,1);
if ($temp==0) {
//adsense version 1 goes here
}else{
//adsense version 2 goes here
}
?>
$temp= rand(0,1);
if ($temp==0) {
//adsense version 1 goes here
}else{
//adsense version 2 goes here
}
?>
Step 2 - Go to you adsense account and create the first version of your ad with a unique channel, for instance make your links blue for version one and paste adsense over the above code where it says "//adsense version 1 goes here".
Step 3 - Go to you adsense account and create the second version of your ad with a unique channel, for instance make your links red for version two and paste adsense over the above code where it says "//adsense version 2 goes here".
Watch it in Action! Click here to see our split test demo.
That's all it takes to split test your adsense! Both versions of your adsense ads will now be served randomly to your blog visitors.
After a few days you can view your adsense stats and see exactly which version of your ad received the most amount of clicks or made you the most money!
You've now eliminated most of the guesswork out of your adsense gameplan and hopefully keep increasing your earnings with this technique.
Notes:
1. The code obviously requires a server that supports php.
2. The code presents ads randomly, not exactly 50/50
3. The code could be streamlined and there are many different similar versions, however the above works fine and is presented in the most easy to understand way.
Enjoy your higher earnings!
If you like this post then please consider subscribing to my full RSS feed. You can also Subscribe to 45n5 by Email and have new posts sent directly to your inbox.
Marios Alexandrou says on March 15, 2007
I used the same technique (except in ASP) a while back to test colors, ad sizes, and ad positions. Another thing to keep in mind is that you should ideally only test one variable at a time. Multiple simultaneous changes can play off of each other and make the results hard to read. That is unless you've managed to wrap your head around multivariate testing.
45n5 says on March 15, 2007
I usually test one thing at a time like borders/noborders or blug/red links or large rectangle/medium rectangle, however that was by accident not by design.
Thanks for the tip Marios.
Sane says on March 16, 2007
I did the same for one of my site but followed another approach... I had adlogger installed on my site.. if the user is already visited ad, then show yahoo ads other wise show adsense... I could not run longer because of the too much database traffic with adlogger ...Just wondering if there is any alternative way of doing this instead of adlogger...
Rubikon says on March 16, 2007
I have st similar here: (its for three versions, tested each after each):
if (($howmuch > 0) and ($howmuch <= 99)) {
echo "version1 html code";
}
elseif (($howmuch >= 100) and ($howmuch <= 199)) {
echo "version2 html code";
}
elseif (($howmuch >= '200') and ($howmuch <= 299)) {
echo "version3 html code";
}
variable howmuch is taken from mysql database:
require_once ('3.php');
// login
$ask = "SELECT id FROM stat";
$result = mysql_query($ask);
$howmuch = mysql_num_rows($result);
Rubikon says on March 16, 2007
And Mark, great post!
45n5 says on March 16, 2007
Thanks for the extra code and compliment Rubikon.
Sane.. I'm not sure another solution to your problem. It may also break the adsense TOS now that they've updated it, or at least be playing in the gray area
https://www.google.com/adsense/support/bin/answer.py?answer=48182
scroll down and read the last part
"In order to prevent user confusion, we do not permit Google ads or search boxes to be published on websites that also contain other ads or services formatted to use the same layout and colors as the Google ads or search boxes on that site. Although you may sell ads directly on your site, it is your responsibility to ensure these ads cannot be confused with Google ads."
Rubikon says on March 16, 2007
Thanx for the advice. But :) I have another problem. How to prevent overfill of mysql table or database? I have simple script with comments, I show last 50 comments on site, but do you know, how to limit maximal number of rows in database?
45n5 says on March 16, 2007
Not sure your answer rubikon however there is no need for a DB to try three variables, something like this will should work
$temp= rand(0,2);
if ($temp==0) {
//adsense version 1 goes here
} elseif ($temp==1) {
//adsense version 2 goes here
} elseif ($temp==2) {
//adsense version 3 goes here
}
Rubikon says on March 16, 2007
well, i mean generally, if i have database full of comments and i leave it for ten years, it will be overfilled. how to prevent this?
45n5 says on March 16, 2007
"well, i mean generally, if i have database full of comments and i leave it for ten years, it will be overfilled. how to prevent this?"
1. remove your comment form or
2. for each query to the database delete entries older than X days
I don't have the code for either just guesses
Rubikon says on March 16, 2007
well 2. - good idea, but how to do it? :)))
45n5 says on March 16, 2007
"well 2. - good idea, but how to do it? :)))"
1. run query to select records older than x days
2. if the query result is greater than 0 you have old records
3. loop through the query results and run a delete for each record on the database (delete where recordID=oldrecordID)
Just the logic, I don't have the code, I did it once upon a time but can't find it, so that parts up to you.
Rubikon says on March 16, 2007
yes, thanx Mark. But one must do it manually,didnt?
45n5 says on March 16, 2007
you do it with php code, not manually
Rubikon says on March 21, 2007
I have new idea - do this with cookie... When someone visit your site for the first time, he will receive first version of advertising. When he will visit in second time, he will see second version of advertising. And on the third time ... you know.
One very little thing lasts - make the php code for this :)
45n5 says on March 21, 2007
I always forget about cookies unless people are logging in and out. good thinking rubikon.
Rubikon says on March 22, 2007
Mark, how you can track all those new comments? I always wonder, how you can reply at almost every post in your comments here ;)
45n5 says on March 22, 2007
"Mark, how you can track all those new comments?"
I get an email every time somebody comments ;-)
I like when people comment back on their blogs to me so I try to do it here, at least while it's still possible.
The 45n5.com Membership SiteTry MashupMoney.com, $1 for 7 day trial.
Start Your Own Membership SiteAmember rocks, free download and trial.
Create Your Own Mailing ListAweber is the best in the business, check them out.








