jquery and google analytics
hi,
i am trying to track outgoing link with jquery and google analytics but i t does not seem to work.
jquery.js is located in my "public html folder were my index.html is located.
i have added the followin lines to the code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>abcdefg </title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<meta name="robots" content="index, follow">
<script type=”text/javascript” src=”jquery.js”></script>
<script>
$('a').each(function(){
var href = $(this).attr('href');
if ((href.match(/^https?\:/i)) && (!href.match(document.domain))){
$(this).click(function() {
var extLink = href.replace(/^https?\:\/\//i, '');
pageTracker._trackEvent('External', 'Click', extLink);
});
}
</script>
</head>
<body>
CONTENT AND LINKS
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape(""));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-XXXXXXX-X");
pageTracker._trackPageview();
} catch(err) {}</script><script type=”text/javascript” charset=”utf-8″>
var dont_track_documents = 1;
</script></div>
</body>
</html>
..................................
please let me know if i have made any errors.
Thanks
M