/ Published in: JavaScript
This code uses jQuery to add on onclick event tracker to all the links in a specific section of the page. Can easily be modified for additional uses. Note that this does not use the custom page view tracker like mentioned here : http://www.google.com/support/googleanalytics/bin/answer.py?hl=en&answer=55527 so that it does not skew your actual page views count.
Expand |
Embed | Plain Text
<script type="text/javascript"> <!-- ga tracking for offsite links clicks --> $(function(){ $("#block-menu-secondary-links .content .menu li a").each(function(){ $(this).click(function () { if(pageTracker != undefined){ pageTracker._trackEvent('Offsite Links', 'Click', $(this).attr("href")); } }); }); }); </script>
You need to login to post a comment.
