![]() |
||||||||||
|
||||||||||
|
PHP: How to Test Google AdSense Ads (and Improve Your Revenue)Improve your Google AdSense revenue by using this simple, free PHP code to test your ads and identify the better paying types and formats.
Why Test AdSense Ads?Modify the default Google AdSense ad format and you are likely to increase your earnings. Google lets you vary many settings including colors of links, borders, text, backgrounds, as well as ad sizes and shapes. Furthermore, you have lots of choices about where to place the ads on your pages.You could run one type of ad for a week, then modify it and compare results. Better yet, test formats simultaneously and start getting side-by-side results to compare the same day. Articles suggest trying out different types and formats for your ads. Then they say you will figure out the format, size and placement that gives you a better click-thru rate and increased revenue. Thats all very nice. Because of all the ways you can vary your ads (different sizes, shapes, locations on your page, link colors, text, border colors, etc.), this can be a long process. That is why I wrote this. This article is written specifically for Google AdSense. You likely can modify it for other types of ads. Because ad providers and their code is always changing, focus on the the general approach because it will likely apply to other advertisers. Important: I recently created Part 2 for testing ads because Google changed how they implement ads. Part 1, below, still works. You can also skip ahead to Part 2. Notable Differences Between Ad Tests Parts 1 and 2The Nature of the Testing Code: Part 1 uses an older format of implementing Google ads. Part 2 uses the new format of implementing Google AdSense ads. Both formats work, but Google no longer provides the option to generate the old version of the ad code that is used and explained in Part 1. AdSense help has an overview of the new system.What is Tested: Part 1 tests an ad with a border versus an ad with no border. Part 2 tests different positions for your ad and content. The Ad Testing Code Part 1Test Performance of Ad With Border vs. No BorderThis page has a white background, so when I say no border I set the color of the border to white (RGB value of FFFFFF). To make your border disappear, set your border color to match your pages background color.I found that ads without a border had better click-thru rates than ads with a border. Take a quick look at the two ads formats we are evaluating in our code before we get too deep into the explanation. Only the border color is different. Everything else remains the same so we do not confuse and confound the test. (The channel ID assigned by AdSense changes, but that is not part of the appearance of the ad. It is for your tracking purposes discussed below.) You could easily vary some other color or size setting for your own purposes. Building the Ad Testing CodeLog into your AdSense account and create 2 custom channels for your site. One channel for each format you are going to test. (Adsense help explains how to set up custom channels.)In your web page, generate a random number of 0 or 1. We use this number to serve up one of two AdSense ads. When the number 1 is generated, display an ad with no border, else display the ad with a blue border.
<?php
srand(time()); $random = (rand()%2); ?> In your AdSense account, generate the AdSense code for the first channel. Our first channel has no (a white) border. Paste it in to your web page code. Then, back in AdSense, generate the code for your second channel, selecting the appropriate custom channel and setting the border color. You will build something like the following: To make it easier to see below, the border color we are varying is in bold text.
<?php
if($random == 1) //test with white border (no border) { ?> <script type="text/javascript"><!-- google_ad_client = "pub-2911253224693209"; google_ad_width = 336; google_ad_height = 280; google_ad_format = "336x280_as"; google_ad_type = "text"; google_ad_channel ="2621593367"; google_color_border = "FFFFFF"; google_color_bg = "FFFFFF"; google_color_link = "0000CC"; google_color_url = "FFCC00"; google_color_text = "000000"; //--></script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> <?php } else //test blue border around ads { ?> <script type="text/javascript"><!-- google_ad_client = "pub-2911253224693209"; google_ad_width = 336; google_ad_height = 280; google_ad_format = "336x280_as"; google_ad_type = "text"; google_ad_channel ="5760339755"; google_color_border = "336699"; google_color_bg = "FFFFFF"; google_color_link = "0000CC"; google_color_url = "FFCC00"; google_color_text = "000000"; //--></script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> <?php } ?> Let the ads run. In your reports you will see roughly equal numbers of each ad being served up. When you determine which format is better, try changing another setting to see what will give you even better click-thrus and revenue. Download the code source (adtest.txt) View page with both ads showing so you can see the differences. Ad Testing Code Part 2Part 2 provides code, examples and an explanation for how to test the performance of your ads with different positions for your ad and content.Notes About Testing AdSense Ad FormatsJust like we tested two different border colors, we could have varied another setting. For example, if you want to see whether black link titles perform better than blue, set one color:
google_color_link = "003366";
and a second color:
google_color_link = "000000";
You can run a more complex test, with, say, three options for a single variable. Modify the random number generating portion of the code to generate a 0, 1 or 2. You should test only one variable at a time (holding all other variables constant). If you test too many variables, you do not know what is performing better. When you get more comfortable with custom channels and with testing various ad formats, you can get more sophisticated with your tests and how you use my little PHP script. The type of test we just did is called an A/B test. If you are beefing up your dev skills or your resume, A/B testing is worth learning. In fact, I will make it my next tutorial. AdSense Terms and Conditions require not modifying the JavaScript or other programming provided to You by Google in any way. The above ad test does not modify Googles code. We are simply randomly serving up one of two scripts. When you look at the HTML source for each format that PHP generates, the scripts are exactly what AdSense generates. We have not modified Google JavaScript or programming in any way.
|
| © 1997-2008. astonishinc.com All Rights Reserved. |