web blazonry web development scripts and tutorials Get best price on Prepaid Samsung Galaxy A10e
   PHP       Name Generators       Perl       CSS       Javascript       Java       MySql       How Tos       Resources   




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

Bookmark and Share




PHP: How to Test Google AdSense Ads & Improve Your Revenue (Version 2)

This free script quickly identifies which Google AdSense formats result in better revenue and higher click-thrus. It tests different ads simultaneously so you can start getting side-by-side results the same day. Many sites, including Google, recommend you test your ads to find the best performing ones for your site. You could run one type of ad for a few weeks, then modify it, run the changes for a few more weeks, then compare results. That takes too long. Use this script.

It is no secret that different settings for AdSense ads give increased revenue and higher click-thru rates. AdSense lets you vary lots of settings such as the colors of links, borders, text, backgrounds, as well as ad sizes and shapes. Plus, you can vary where you place the ads on your pages and find that you get different results. This article helps you with testing and getting quick results.


How This Test Differs From Ad Test Version 1

The script in testing Google Ads Version 1 tested an ad with a border versus an ad with no border. The tutorial and code are still good and can be used. It remains a helpful example.

Version 2 (the script on this page) tests different placements (ad locations) on the page for your ad. 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.

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

How To Test AdSense Ads (Version 2)

Test Performance of Ad Placement

I read that ads placed in the top left corner of the content area (content area excludes navagation elements and identity/header sections) performed better than tall skyscraper ads along the left or right side of the content. Tests have shown that a reader’s eyes go to the top left region of the main content area first.

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

No one say which one will work better for you. Your results will depend on your content and page design. Use my script to test and find out. You will know quickly. You can even use it for another test by picking different two things to test against each other.

Let’s look at the two ads we are testing by looking at the Google ads above on this page. For content starting below the ad, I refer to the layout as “Format 2-A” (meaning, test ads version 2 - format A). For content to the right of the ad, I refer to the layout as “Format 2-B” (meaning, test ads version 2 - format 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, it generates a random number of 0 or 1. 50-50 chance of either. The script uses 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, ad sizes, text color, border, etc. according to your own needs and interests.

Building the Code for Testing Ads (Version 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 my ad code and publisher ID with yours.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 a different AdSense setting to see what will give you even better click-thrus and revenue.

Grab the source code here  (adtest2.txt)

Related Information

Ad Test Version 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 Ver. 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
Baby Name Generator
U.S. Name Generator
Wu Name Generator
Popup Windows (JavaScript)
Upload and Resize an Image (PHP)
How To Install Apache + PHP + MySQL
Intro to Web Databases (PHP, MySQL)

Least Popular Pages
iNews Applet (Java)
Java Resources
Site Monitor (Perl)
PHP Resources
 
 

  privacy policy     ||     © 1997-2016. astonishinc.com   All Rights Reserved.