Google Analytics – How To Manually Track Clicks On External Links

VN:F [1.9.17_1161]
Rating: 5.0/5 (1 vote cast)
8 Comments 768 views

There is a tutorial on Google which explains How do I manually track clicks on outbound links?

However that tutorial doesn’t help a lot for non-geeks.

This is my effort to simply the outbound link tracking.

Assuming that you are using Asynchronous Google Analytics Tracking Code follow these steps

Step 1

Add following code just before closing head </head>

<script type="text/javascript">
  function recordOutboundLink(link, category, action) {
    _gat._getTrackerByName()._trackEvent(category, action);
    setTimeout('document.location = "' + link.href + '"', 100);
  }
</script>

Step 2

For each external/outbound link which you want to track add the tracking information

<a onclick="recordOutboundLink(this, 'External Website', 'externalwebsite.com');return false;" href="http://www.externalwebsite.com">

Google Analytics Report

You can find this outbound link tracking report under Google Analytics Content->Even Tracking

Google Analytics Outbound Link Tracking

Google Analytics Outbound Link Tracking

You can see more details on this report from the menus in left.

Google Analytics - How To Manually Track Clicks On External Links, 5.0 out of 5 based on 1 rating

Similar Posts

8 Responses to “Google Analytics – How To Manually Track Clicks On External Links”

  1. Chris 27. Apr, 2011 at 3:43 am #

    Do you know how to do this without having to add tracking code to every single link? Is there a way to track all outgoing links easily?

    [Reply]

    Ajay Kumar Singh Reply:

    Unfortunately yes, you have to add tracking code to each outgoing link.

    I don’t think there is any other easier way to track all outgoing links.

    [Reply]

    VN:F [1.9.17_1161]
    Rating: 0 (from 0 votes)
  2. Ashley Bryan 30. Apr, 2011 at 7:18 am #

    At last! Someone has put it simply. Thank you!

    [Reply]

    VA:F [1.9.17_1161]
    Rating: 0 (from 0 votes)
  3. ganesh 30. Jul, 2011 at 8:45 am #

    hai

    [Reply]

    VA:F [1.9.17_1161]
    Rating: 0 (from 0 votes)
  4. luis 03. Oct, 2011 at 12:54 pm #

    But that will not open a new page… What must be changed?

    [Reply]

    Ajay Reply:

    I think it is not possible to use _blank in the outbound link, so unfortunately you can’t open the link in a new window.

    [Reply]

    Christopher Regan Reply:

    Ajay: did you ever get your _blank to work with event tracking?

    Cheers,

    Christopher

    [Reply]

    Ajay Reply:

    Nop.
    AFAIK it is official that it doesn’t work. It is not possible.

    [Reply]

    VN:F [1.9.17_1161]
    Rating: +1 (from 1 vote)

Leave a Reply

Notify me of followup comments via e-mail. You can also subscribe without commenting.