April 7, 2007

Visitor Click Tracking in Adsense, Chitika and YPN with Google Analytics

If you carefully analyze the Google Adsense Unit displayed just above, you will notice that the ad offers three exit routes where a website visitor can click.

Route 1. Visitor can click on any of advertised products
Route 2. Visitor clicks the Ads by Google link to submit feedback to Google
Route 3. Visitor clicks the Advertise on this site link - maybe to sign as an adwords advertiser

Of these three possible exit routes, only the first route converts into dollars. As an Adsense publisher, I am very keen to track what visitors are clicking while exiting your website. If lot of my visitors are exiting my website by clicking the "Advertise on this site" without signing up as an Adwords advertiser, I will probably disable the feature.

So how do we track visitor clicks in Adsense units ? There are couple of commercial adsense tracking scripts but recently, Shawn earlier released a JavaScript snippet that allows you to track visitor clicks on products displayed in Google adsense unit. Shawn’s script work great but tracks only Google Adsense Clicks for Route 1.

Here is a slightly modified version of the visitor click tracking script that offers some more advantages:

a. Offers visitor click tracking for Adsense, Yahoo YPN and Chitika eMiniMalls.
b. Find how many visitors clicked on "Ads by Google" link to submit feedback about Google ads on your website.
c. View statistics separately for clicks on Google Adsense Text / image Ads and Google Adlink units.
d. Find how many potential advertisers clicked the "Advertise on this site" link.
e. Track how may left your website by clicking the Yahoo Publisher Network without click the YPN ad.

For geeks, here’s how the click tracking script : The script loops through all of the IFRAME on the page, and if the IFRAME source includes a google or chitika or yahoo ad server address, it will attach the corresponding function as an onfocus handler. When the ad unit obtains focus, urchinTracker() is called, with a goal identifier.

<script type="text/javascript">
function trackAdvertiserSignUp()
{
  urchinTracker("/GoogleAdwordsSignup");
}

function trackGoogleFeedbackClick()
{
  urchinTracker("/AdsByGoogleFeedback");
}
function trackYPNFeedbackClick()
{
  urchinTracker("/YahooPublisherFeedback");
}
function trackYPNClick()
{
  urchinTracker("/YPNClick");
}    
function trackChitikaClicks() {
  urchinTracker ("/ChitikaClick");
}
function trackGoogleAdsenseClicks() {
    urchinTracker("/GoogleAdSenseClick");
}
function trackGoogleAdlinkClicks() {
    urchinTracker("/GoogleAdLinkClick");
}
var elements;

if(document.getElementsByTagName) {
    elements = document.body.getElementsByTagName("IFRAME");
} else if (document.body.all) {
    elements = document.body.all.tags("IFRAME");
} else {
  elements = array();
}
for(var i = 0; i < elements.length; i++) {
if(elements[i].src.indexOf

("pagead2.googlesyndication.com/pagead/iclk") > -1) {
elements[i].onfocus = trackGoogleAdsenseClicks;
} else if (elements[i].src.indexOf

("pagead2.googlesyndication.com/pagead/ads") > -1)
elements[i].onfocus = trackGoogleAdlinkClicks;
} else if (elements[i].src.indexOf("adwords.google.com") > -1)
{elements[i].onfocus = trackAdvertiserSignUp;
} else if (elements[i].src.indexOf("services.google.com") > -1)
{elements[i].onfocus = trackGoogleFeedbackClick;
} else if (elements[i].src.indexOf("mm.chitika.net") > -1)
{elements[i].onfocus = trackChitikaClicks;
} else if (elements[i].src.indexOf("overture.com") > -1)
{elements[i].onfocus = trackYPNClick;
} else if (elements[i].src.indexOf("publisher.yahoo.com") > -1)
{elements[i].onfocus = trackYPNFeedbackClick;
}
}
</script>

Shawn’s Javascript works only with IE browser. Aaron Wall released a modified version of Adsense Click Pepper script that seems to work with Firefox (Gecko), Safari, Konqueror browsers. The Adsense Click Pepper script uses mouse cursor position prior to page unload to help detect AdSense clicks in Firefox

Comments »

The URI to TrackBack this entry is: http://adsensehelp.blogsome.com/2007/04/07/visitor-click-tracking-in-adsense-chitika-and-ypn-with-google-analytics/trackback/

No comments yet.

RSS feed for comments on this post.

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>



Anti-spam measure: please retype the above text into the box provided.