I use google analytics on my website and it works perfectly, except when I want to track the number of downloaded images.
The code I use looks like this, and I don't understand why it does'nt work. Someone who knows?
<html>
<head>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'XX-XXXXXXXX-X']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body>
<a href="download.php?dir=images/paris/20100922&file=_MG_1457.jpg" onClick="javascript: pageTracker._trackPageview('/downloads/_MG_1457.jpg');"><img src="images/paris/20100922/_MG_1457_thumb.jpg" /></a>
</body>
</html>