1 - You must download the js file from jQuery.com and include it in your header like this
<script type="text/javascript" src="js/jquery-1.2.3.js"></script>
2- To link ONLY to an external site, we have to check the presence of the string http:// at the beginning of the value of the link’s href attribute. We could select links with an href value starting with http:// with the following code in your header:
<script>
$(document).ready(function() {
$("a[href^=http://]").onclick(function() {
pageTracker._trackPageview( $(this).attr("href") ) ;
return false;
});
});
</script>
Note: After this is done, if you check the source code, "YOU" will only see the basic code <a ref="http://www.example.com" ;"> but the "BROWSER" will read ;
For external link:
<a href="http://www.example.com" onClick= pageTracker._trackPageview('http://www.example.com');">
Internal link:
<a href="hello_world.asp">
This is the beauty of Unobtrusive JavaScript... no need to play in the HTML tags!
Enjoy!
//JF//