How to Track External Links with Google Analytics


The Problem

By default, Google Analytics treats outbound links to external sites as exits. However, there are often times when it is helpful to track external links separately from other types of exits. For example, if you need to track how many leads a site or link is sending to another site.

A Solution: Track External Links as Events

The key to making this kind of tracking work is to use the Analytics API while staggering the external link so that the API call can complete.

Here is a javascript example of how this can be done:

<!-- JavaScript to be called from the links' onCLick -->

And here is how the link would look:

<a onclick="return trackOutgoingLink(this, 'GOOGLE', 'click');" href="">Google It</a>

Using the above method, clicks on the “Google It” link will appear under the “GOOGLE” event category. Read more about Google Analytics events here.

Let us know if you have any questions!