web blazonry web development scripts and tutorials
 
Web blazonry.com
   Home       PHP       Name Generators       Perl       CSS       Javascript       Java       devTips       Resources   




PHP Name Generators
  Wu-Name
  U.S. Name
  Baby Name





PHP: How to Test Google AdSense Ads and Improve Your Revenue Part 2

This is a newer version of my free PHP script and tutorial for testing Google AdSense ads in order to help you identify which ad format performs better for you.

How This Test Differs From Ad Test Part 1

Testing Google Ads Part 1, tested an ad with a border versus an ad with no border.

Part 2 tests different positions for your ad and content. I even use the code explained here to generate the ads at the top of this page. Refresh the page and you have a 50-50 chance of getting the alternate ad format.

Part 2 uses the new format of implementing Google Ads.  AdSense help has an overview of the new system.

Ad Test Code Part 2

Test Performance of Ad Placement

I read that ads placed in the top left corner of the content area (excludes navagation elements and identity/header sections) performed better than tall (“skyscraper”) ads along either side of the content. The top left region of the main content area is where a reader’s eyes go first.

Part 2 tests two ways to place an ad at the top left region of the content. Though these two formats are not much different, they resulted in different click-through rates.

I cannot say which one will work better for you. Your results will depend on your content and page design. Test and find out. Then modify the ads to test two other formats.

Let’s look at the two ads we are testing by looking at the Google ads above on this page. When the content starts below the ad, I refer to the layout as “Format 2-A.” When the content is positioned to the right of the ad, I refer refer to the layout as “Format 2-B.”

Refresh this page in your browser. You have a 50-50 chance of getting the alternate ad layout. If you do not get a different layout, refresh again. If that still does not work, your browser might need a “hard refresh.”

How the Ad Test Script Works

First, generate a random number of 0 or 1. Use this number to serve up one of two AdSense ads. When the number 1 is generated, run Format 2-A, else run Format 2-B.


Notes:
  • Because it fits the page layout better, Format 2-A has a 336 pixels wide ad (336x280 large rectangle) while Format 2-B uses a 300 wide ad (300x250 medium rectangle). In testing, I generally try to vary only one thing, but here I admit to using 2 ad sizes in addition to the differing layouts. The size difference between 336 and 300 is not that great and the improved look is worth it in my mind.
  • You might notice the channel ID in the code is different in the two formats. Each ad has its own channel for tracking purposes as discussed below. You will get your own channel IDs when you generate your code as described below.
  • You could easily test link colors, or ad sizes or text color etc. according to your own needs and interests.

Building the Code for Ad Test Part 2

Log 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.)

Next, in your AdSense account, generate the AdSense code for Format 2-A. Paste it in to your web page code. Then, back in AdSense, generate the code for your Format 2-B (using the second channel), selecting the custom channel you want.

Copy and paste the scripts that Google generates into the sections of ad code code below, replacing your ads with mine.You will build something like the code below.

Note: I used HTML tables to get the ad and content layout. I could have used stylesheets, but thought HTML tables were the easiest to explain and illustrate the concept.

<?php
   srand(time());   //first generate the random number
   $random = (rand()%2);

   if($random == 1)  //use Format 2-A
   {
?>
   <!-- start Google ad -->
   <script type="text/javascript"><!--
   google_ad_client = "pub-2911253224693209";
   google_ad_slot = "7837762649";
   google_ad_width = 336;
   google_ad_height = 280;
   //-->
   </script>
   <script type="text/javascript"
   src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
   </script>
   <!-- end Google ad -->

<?php
   }
   else     //use Format 2-B
?>
   <table border="0" cellspacing="5" cellpadding="2" align="left"><tr><td>
   <!-- start Google ad -->
   <script type="text/javascript"><!--
   google_ad_client = "pub-2911253224693209";
   google_ad_slot = "0483297374";
   google_ad_width = 300;
   google_ad_height = 250;
   //-->
   </script>
   <script type="text/javascript"
   src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
   </script>
   <!-- end Google ad -->
   </td></tr></table>

<?php
   }
?>

Let the ads run.

Your reports should show roughly equal numbers for 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  (adtest2.txt)


Related Information

Ad Test Part 1 testing provides another example of testing Google ads as well as an introduction to testing ads.

Notes about testing ads provides more insight into the testing process and a note about the fact that this PHP script complies with AdSense Terms and Conditions.

 

Newest Pages
Test Google Ads Part 2
Free Linux Admin Books
Free Linux Books for Programmers
Free Books for Linux on the Desktop
Free PHP Books
Free JavaScript Books
Free Java Books - Advanced
Free Java Books - Basic
Free Perl Books
Free Python Books
Quote of the Day (PHP)
Debugging Part 2
How to Test Google Ads
Most Popular Pages
U.S. Name Generator
Baby Name Generator
Wu Name Generator
Popup Windows (JavaScript)
Intro to Web Databases (PHP, MySQL)
Upload and Resize an Image (PHP)
How To Install Apache + PHP + MySQL

Least Popular Pages
iNews Aplet (Java)
Java Resources)
Site Monitor (Perl)
Load Order of Images(Javascript)
 
 

  © 1997-2008. astonishinc.com   All Rights Reserved.