Posted By

dsntos on 03/01/09


Tagged

google jquery Analytics


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

Bluewall
rickfu
Kurt
Balamir


Track clicks with Google Analytics


 / Published in: jQuery
 

URL: http://www.prodevtips.com/2008/08/19/tracking-clicks-with-jquery-and-google-analytics/

  1. $(document).ready(function(){
  2. var localserver = "www.prodevtips.com";
  3. $("a").not(".kLink").not("a[href^='http://"+localserver+"']").click(function(){
  4. $(this).attr("target", "blank");
  5. var url = $(this).attr("href").replace(/^http\:\/\/(www\.)*/i, "");
  6. pageTracker._trackPageview('/external/'+url);
  7. });
  8. });

Report this snippet  

You need to login to post a comment.