Skip to main content

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.



Here is the full Javascript code. You need to place it after all your chitika, google adsense and chitika javascript code. The most recommended position is just before the closing </body> tag. Google has clarified that it would not violate the AdSense Terms and Conditions to use Google Analytics to track outgoing clicks.

For geeks, here's how the click tracking script works: 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.

You will also have to create individual goals in Google Analytics for your website profile. Google lets you define only 4 goal, so choose wisely. You can always add new goal and delete the older ones.
<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.

Download SEOBook javascript source | Track AdSense Clicks With Google Analytics | Read Shawn's blog post | Read Aaron Wall's post | How to define a Goal in Google Analytics

Popular posts from this blog

How to Download Contacts from Facebook To Outlook Address Book

Facebook users are not too pleased with the "walled garden" approach of Facebook. The reason is simple - while you can easily import your Outlook address book and GMail contacts into Facebook, the reverse path is closed. There's no "official" way to export your Facebook friends email addresses or contact phone numbers out as a CSV file so that you can sync the contacts data with Outlook, GMail or your BlackBerry. Some third-party Facebook hacks like "Facebook Sync" (for Mac) and "Facebook Downloader" (for Windows) did allow you to download your Facebook friends' names, emails, mobile phone number and profile photo to the desktop but they were quickly removed for violation of Facebook Terms of Use. How to Download Contacts from Facebook There are still some options to take Friends data outside the walls of Facebook wall. Facebook offers the Takeout option allowing you to download all Facebook data locally to the disk (include

Firefox Keyboard Shortcuts for Power Users

All features in Mozilla Firefox browser are accessible through the use of the keyboard. You can use shortcut keys to view and save Web pages, search the web, open new webpages, work with bookmarks, or find text on the current webpage. Some of the most common keyboard shortcuts in Mozilla Firefox are Ctrl+N (to open a new Firefox window), Ctrl+T (to open a new tab), Ctrl+F4 (to close the current tab) and Ctrl+S to save the current webpage. Mozilla Firefox supports many more powerful keyboard shortcuts. For instance, by pressing a simple key combination, you can manually delete autocomplete entries from the Firefox location bar or Web forms. I am sharing a list of my favorite Mozilla Firefox Keyboard Shortcuts that make web browsing with Firefox even more fun . And you also save your precious time as navigating through several layers of Firefox Toolbar menus is no longer necessary. 1. Web Search Ctrl+K moves the cursor to the Search Bar. You can then type in the terms you wish to fin

Digital Inspiration

Digital Inspiration is a popular tech blog by  Amit Agarwal . Our popular Google Scripts include  Gmail Mail Merge  (send personalized emails with Gmail ),  Document Studio (generate PDFs from Google Forms ) and   File Upload Forms ( receive files  in Google Drive). Also see  Reverse Image Mobile Search , Online Speech Recognition and Website Screenshots , the most useful websites on the Internet.