pf » Tracking JavaScript Events with Google Analytics
Tracking JavaScript Events with Google Analytics
Did you know that you can track JavaScript events with Google Analytics? I just found this out... It's pretty cool, because allows you to track things like outbound link clicks, AJAX calls, static files, and more.
It's quite simple to do, just call the urchinTracker function (make sure that your urchin code defined before and above calling this function), and pass in a url. It will then track log the url as if it were a regular page visit. So for example lets say you wanted to log downloads of a zip file...
<a href="stuff.zip" onclick="urchinTracker('/downloads/stuff');"> download </a>
You can use the same method to log a outbound link click...
<a href="http://adobe.com/" onclick="urchinTracker('/outgoing/adobe_com');"> adobe </a>
You should see /downloads/stuff and /outgoing/adobe_com in your reports within 24-48 hours.
add to del.icio.us
| Tags: google, analytics, javascript, ajax, urchintracker, urchin
Related Entries
- GoogleBot Runs AJAX? - December 6, 2006
- jQuery UI Sortable Tutorial - January 7, 2010
- Ajax Same Origin Policy No More with Firefox 3.5 - June 30, 2009
- Google's JavaScript API Loader - November 26, 2008
- Adobe AIR Tutorial for HTML / JavaScript Developers - February 25, 2008
http://www.beringer.net/IT-Services-Consulting.aspx
http://www.beringer.net/MiniContactUs.aspx
But I have a question, Pete. I've implemented the tracking code, but can't find the "Events Categories" in the reporting. Do you know where the events that are tracked will appear?
- J2EE Session Cookies on ColdFusion / JRun
- Hands on ColdFusion Security Training
- ColdFusion 9 Solr Vulnerability - Are you at Risk?
- FCKEditor Year 2010 Bug for Firefox 3.6
- jQuery UI Sortable Tutorial
- CFLogin Security Considerations
- Use varchar(max) instead of text in SQL Server
- ColdFusion SOAP Web Services and onRequestStart
RSS


Pete Freitag is a software engineer, and web developer located in











