Wednesday 7 September 2011

How to track banner ad exits?

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.
To track outbound clicks on an animated GIF or other type of static banner ad, add the following code within the <a> tag:

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


This code uses the _trackPageviewfunction to log each click on the banner as though it were a pageview named /bannerads/advertisername/bannername. You may use any folder/filename structure that you desire, though it's a good idea to log all of your advertising banners into a logical directory structure as shown in the example. This helps to easily identify the number of referrals to each advertiser.

The equivalent code for a Flash banner is provided below:

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


Important: if your pages include a call to _trackPageview, _setAllowLinker _trackTrans(), your Analytics tracking code must be placed in your HTML code above any of these calls. In these cases the tracking code can be placed anywhere between the opening <body> tag and the JavaScript call.

No comments:

Post a Comment