Google Analytics Workshop

register | login

Outbound links

Tracking outbound link selection on a web page using Google Analytics

This page provides a very simple example of tracking outbound links from a web site page.

The outbound links section below contains three outbound links to pages on different web sites. Under normal circumstances, with a default Google Analytics installation, it would not be possible to trace user selection of these links.

To enable tracking we use the _trackEvent method—JavaScript commands that are loaded into any page with Google Analytics enabled properly in the document head. This should be triggered using an onClick handler within the outbound link HTML element.

The possible parameters with _trackEvent are:

  • category—an event category for distinguishing different types of events in Google Analytics reports. In this case we will set a category value of Outbound.
  • action—the actual action of the event. In this case we will set a value of Link to video.
  • opt_label—an optional descriptor for the event. In this case we will set this to the page title of the outbound link.
  • opt_value—an optional value associated with an event. Here it is not used.
  • opt_noninteraction—a flag to indicate whether the event will impact a visitor's bounce rate or not. In this case it is not used.

Outbound links

The human power shower
The human power shower—outbound link number 1, to a funny youtube item with an underlying lesson about the implications of staying in the shower too long.
The ubiquitous utility of an iPad
The ubiquitous utility of an iPad—outbound link number 2, proving that not everyone is up to date with technology.
The intrinsic intelligence of the young
The intrinsic intelligence of the young—outbound link number 3, suggesting that we should be retiring sooner rather than later.

The relevant source

<dl>

<dt>
<a href="https://www.youtube.com/watch?v=C93cL_zDVIM" target="_blank" onclick="_gaq.push (['_trackEvent', 'Outbound', 'Link to video', 'The human power shower']);">
The human power shower</a>
</dt>
<dd>
<b>The human power shower</b>—
<i>outbound link number 1</i>, 
to a funny youtube item with an underlying lesson about the implications of staying in the shower too long.
</dd>

<dt>
<a href="http://www.wimp.com/dadipad/" target="_blank" onclick="_gaq.push (['_trackEvent', 'Outbound', 'Link to video', 'The ubiquitous utility of an iPad']);">
The ubiquitous utility of an iPad</a>
</dt> 
<dd>
<b>The ubiquitous utility of an iPad</b>—
<i>outbound link number 2</i>, 
proving that not everyone is up to date with technology.
</dd>

<dt>
<a href="http://www.youtube.com/watch?v=aXV-yaFmQNk" target="_blank" onclick="_gaq.push (['_trackEvent', 'Outbound', 'Link to video', 'The intrinsic intelligence of the young']);">
The intrinsic intelligence of the young</a>
</dt>
<dd>
<b>The intrinsic intelligence of the young</b>—
<i>outbound link number 3</i>, 
suggesting that we should be retiring sooner rather than later.
</dd>

</dl>

Google Analytics reports

Here are 3 screenshots of the Google Analytics reports showing the event traffic when it is first set up (Real-Time) and how it is recorded over time in the Behavior reports. Select each image to view a larger image.

Real-Time report

This shows the Real-Time report showing the event actioned over the secs/mins.

Real-Time report

Selecting the 'Outbound' link of the Real-Time reports shows the action and label of each 'Outbound' link

Behavior Events report

The 'Behavior' -> 'Events' -> 'Overview' report