Track Outbound Links to New Windows with Google Analytics

You can use Google Analytics to track when a user clicks on a link that takes them to an external website using the code snippet in the link below:

However this method is flawed as it opens all links in the same window, regardless of the "target" attribute on the link. To get full link target support, use the code snippet below. In this example it is used in conjunction with a small jquery snippet to automatically track all links with the class "track" on a page.

Facebook Twitter Google+ LinkedIn Buffer
Leave us a Comment

Connect With Us

Get our monthly newsletter with tech tips for business professionals