Analytics
2K members online now
2K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
 
Guide Me
star_border
Reply

Can't open links in a new tab when tracking outbound links

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi there,

 

When trying to track outbound links by using Google's script:

onclick="trackOutboundLink(''); return false;"

The <a> link doesn't open in a new tab despite the "_blank" target.

Anybody has experienced a similar problem before?

 

Thank you in advance.

Re: Can't open links in a new tab when tracking outbound links

Follower ✭ ✭ ✭
# 2
Follower ✭ ✭ ✭
Thats because "return false;"
you'e preventing Click event handler to follow default browser behaviour (which is open the href link).

Try removing "return false;" or what's the purpose here?

Can&#39;t open links in a new tab when tracking outbound links

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

If you remove "return false" it opens the link in the new tab, but the old tab changes to the link you have clicked on too. If you change to "return true" the same happens. Anyone worked this out yet?