Tracking Banner Ad Exits and Other Outbound Links

If you publish advertising banners on your site, there is an easy way for you to track which banners visitors click on to leave your site and which advertisers they visit.

For an animated GIF or other type of static banner ad, you would add the following code:


<a href="http://www.advertisersite.com"
onClick="javascript:urchinTracker
('/bannerads/advertisername/bannername');">

This code causes each click on the banner to be logged as though it were a pageview named /bannerads/advertisername/bannername. It is a good idea to log all of your advertising banners into a logical directory structure such as /bannerads/the name of the advertiser/the name of the banner. This way, you will be able to easily identify the number of referrals to each advertiser.

The equivalent code for a Flash banner is provided below:


on (release) {
     
getURL("javascript:urchinTracker('/bannerads/advertisername/bannername');");
      getURL("http://www.advertisersite.com");

}