I'm having a small but annoying problem with trying to open a link in a new window. I've built a site and I've got Google Analytics tracking installed. I've tracked click throughs to external sites as events and have put in the correct and it all tracks properly. For each of these links I've put in the target="_blank"
but for some reason the link doesn't open in a new window! Is there something that I am doing wrong? Code below:
<a onclick="recordOutboundLink(this, 'Outbound Links', 'Link');return false;" href="http://www.mylink.com" target="_blank">Myink</a></span></li>
Is it something to do with the order it's in? I just can't seem to get it to work!
Thanks in advance.
As requested here is the code for recording the links:
<script type="text/javascript">
function recordOutboundLink(link, category, action) {
try {
var pageTracker=_gat._getTracker("UA-XXXXXX-XX");
pageTracker._trackEvent(category, action);
setTimeout('document.location = "' + link.href + '"', 100)
}catch(err){}
}