Did you know that links to downloadable files like PDFs and links to external sites are not tracked in Google Analytics? If you are including links to non uwgb.edu websites or downloadable files and want tracking data on the number of people clicking these links, there are two ways you can make them send tracking data to Google Analytics.

Option 1 – Track as a Regular Pageview

The first option is to tell Google Analytics to track the link as a pageview, just like any other page on your site. This used to be the only way to track links, and while it may still be acceptable for links to on-site content, it’s a bit misleading using a pageview for an external link (it artificially inflates your pageviews, pages per visit, time on site, and other visitor metrics).

Because of the way our Google Analytics profiles work, please be sure to include the main folder (subdirectory) of your site in the tracking code where you see /webshare/ (in the code below) or you won’t be able to see your data.

External Links (not recommended)

<a href=”http://sample-external-link.com” onclick=”_gaq.push(['_trackPageview', '/webshare/outbound/unique-link-name/']);”>Sample External Link</a>

Internal Downloads

<a href=”/pdf/sample-download.pdf” onclick=”_gaq.push(['_trackPageview', '/webshare/pdf/unique-pdf-file-name/']);”>Sample Download (PDF)</a>

Option 2 – Track as an Event

Your other option is to track the link click as an action in Google Analytics. This is the newer method and is more appropriate for external links. Events stats are found in Google Analytics under Content > Events.

External Links

<a href=”http://sample-external-link.com” onclick=”_gaq.push(['_trackEvent', 'Links', 'External', '/webshare/outbound/unique-link-name/', 0, true]);”>Sample External Link</a>

Internal Downloads

<a href=”/pdf/sample-download.pdf” onclick=”_gaq.push(['_trackEvent', 'Links', 'Download', '/webshare/pdf/unique-pdf-file-name/']);”>Sample Download (PDF)</a>

Resources