views:

14

answers:

0

I am currently attempting to track outbound links with Google Analytics and seemingly having some issues. I modified the provided GA code to open in an external window but it seems that a good portion of clicks are not being tracked. My question is does it seem like there could be reason why this code could not work or is there an alternative to opening links in a new window?

// at head of page along with GA code    
function recordOutboundLink(link, category, action) {
    try {
      var pageTracker=_gat._getTracker("UA-6398157-1");
      pageTracker._trackEvent(category, action);
      setTimeout(window.open(link.href), 100);
    }catch(err){}
  }

//inline code for links
onClick="recordOutboundLink(this, 'Outbound Links', 'http://www.example.com/'); return false;"