gaAddonsgaAddons - Google Analytics Addons by Stéphane Hamel

Documentation: Calls Reference

_trackOutbound

Track outbound links as "outbound" click events. Once this call is included you do not have to modify individual links to track them.

Caveats

If both _trackOutbound and _trackDownload are present and the link leads to an externally downloadable document, the same event will be tracked under two distinct metrics.

Simple call

_gaq.push(['_trackOutbound']);
      

Advanced call

_gaq.push(['_trackOutbound', {
	onBounce: true, // optional boolean
	method: 'event', // optional 'event'|'page'
	category: 'outbound', // optional string
	action: 'click', // optional 'click'|'mouseup'
	value: 0, // optional real
	include: /./, // optional regex
	exclude: /^$/, // optional regex
	format: '/%category%/%action%/%hostname%%pathname%', // optional string
	selector: 'a', // optional jQuery selector
	buttons: ['click','clickl','clickm','clickr']
	}]);
      

How to use this data

_trackOutbound
When using the "event" method, you can easily see which external links are being clicked from which page and how popular they are. In the example below, we notice one of the most popular link from the immeria blog is the download of the Template_Dashboard_080811.xlsx file from the Even More Web Analytics Dashboard Fun with Excel blog post.

Note that in this example, if _trackDownload is also used, you will also see the Excel document download.

Parameters

onBounce true|false
By default (true), the tracking will affect the bounce rate. If this option is false, the outbound link will not be tracked if happening on the first page view of a visit.
method 'event'|'page'
By default, outbound links are tracked as events. If any other value, a fake page view will be generated (this was how things were done before GA introduced events). This parameter default value is set to 'event'.
category 'outbound'|string
Outound links are tracked with a Category, Action, optional Label and optional Value. This is the label that will show under the Content/Event Tracking/Categories report. If not using events, Category, Action and Label will be the faked page hierarchy represented as /Category/Action/Label. Label is the URL of the outbound link. This parameter default value is 'outbound'.
action 'click'|'mouseup'
The event label showing up under GA report /Content/Event Tracking/Actions. If action is set to 'mouseup' then the left, middle and right mouse buttons will be tracked as well as the regular 'click' event. Be forewarned using 'mouseup' simply means those buttons were pressed, not that the link was actually followed (i.e. someone can press the right-button to "open in new window", "save as..." or nothing at all). This parameter default value is 'click'.
value 0|real
If using the event method, you can assign a value for this event. This parameter can not be used when method is set to 'page'. This parameter default value is 0.
include /^$/|regex
The include filter is used to narrow down which outbound links are to be tracked. This parameter default value is /./, meaning all outbound links will be tracked.
exclude /^$/|regex
The exclude filter can be used to exclude outbound link tracking for specific URL patterns. By default, nothing is excluded (/^$/ will always be false). For example, if you set this option to /myotherdomain.com/ all outbound links will be tracked (based on the 'include' parameter filter) except any links going to myotherdomain.com.
Note: if the exclude rule is /^$/ it will be automatically replaced with /domainname/ so any internal links are excluded.
format '/%category%/%event/%hostname%%pathname%'|string
Specify the desired taxonomy for tracking. A number of special strings can be replaced by their run-time values in order to categorize the data in the way you want. The list of supported variables are:
  • %category% - the value of the "category" option
  • %action% - the value of the "action" option
  • %target% - the A HREF TARGET value
  • %value% - the value option
  • %pagename% - the current page title
  • %title% - the link text
  • %href% and its attributes (refer to JavaScript documentation)
  • %filetype% - the part of %pathname% after the last .
  • %location% - the current page url (also supports %location.xxx% where xxx is any of the standard location attributes (refer to JavaScript documentation)
Note: If tracking with an event, the 1st path level is the category, the 2nd one is the action, and anything else is the label.
Make sure to begin the format with a '/' and have at least three of them. Tracking with page views doesn't have this constraint.
selector 'a'|jQuery selector
Advanced use only: allow you to specify an alternative jQuery selector.
button ['click','clickl','clickm','clickr'] | string array
A four items array that represent a generic button click, left-click, middle-click or rick-click labels

info online online info