Switch to full style
JQuery Examples
Post a reply

How to track clicks on hash links from Google analytic

Sun Jan 20, 2013 1:35 pm

How to track clicks on hash links from Google analytics
javascript code
<html>
<head>
<title>Follow clicks on hash links </title>

<!--
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
</script>
Note you can download the JQuery package instead of using Google version. -->
<script src="jquery-1.8.3.js"></script>


<script>
$(document).ready(function(){
//
// Track clicks on hash links using Google analytics.

function loadOnClick() {

$('a#hashLink').each(function(){

$(this).attr("onclick", "_gaq.push(['_trackPageview'," +
"location.pathname + location.search + jQuery(this).attr('rel')]);" );
});
}
loadOnClick();
});
</script>
</head>
<body>

</div>
<a href="#hash" rel="contact" id="hashLink" >Follow me.</a>
</body>
</html>




Post a reply
  Related Posts  to : How to track clicks on hash links from Google analytic
 get time difference between to mouse-clicks-double clicks     -  
 Can i track calls from mobile phones     -  
 queue of objects keep track of the front and rear     -  
 track session from login page-J2EE project     -  
 show the locations of clicks on the image     -  
 draw any number of circles using mouse clicks     -  
 avoid multiple submit clicks using javascript     -  
 Applet get mouse clicks and draw circle     -  
 draw any number of lines on mouse clicks     -  
 Draw Cardinal Spline With Mouse Clicks Points     -