Most people have only used the basic copy / paste of the Google Analytics scripts to track outbound links and downloads. Now that Google offers events tracking, you can now track much more than the standard pageviews when tracking outbound links and downloads.
Immeria.net has created an add-on for Google Analytics that automates the tracking of some comment tagging requirements – outbound links, download links, and email links. It improves the GA implementation process as well as reduces the possibility of errors when setting up the actions. You can simply include the script after your standard Google Anlytics script and you’re done!
Tracking Variables
The basic tracking variables of each event are below:
- Outbound Links:
- Event: “outbound”
- Action: “click”
- Label: target URL
- Email Links:
- Event: “email”
- Action: “click”
- Label: target URL
- Download Links:
- Event: “download”
- Action: “click”
- Label: URL of downloadable document. The default looks for the following regular expression:
/\.(docx*|xlsx*|pptx*|exe|zip|pdf|xpi)$
It basically says: “Look for any links ending with a dot, followed by any of the popular file extension”
Those can easily be changed in the gaAddons.js script.
Implementation Steps
To get started with the add-on script, you just follow these two steps:
- Download the gaAddons.js script and save it somewhere on your own server.
- Add this line near the closing BODY tag of all your pages, just after the standard Google Analytics tag:
<script src=”gaAddons.js” type=”text/javascript”></script>