Quantcast

Wednesday, December 3, 2008

Tracking Java Versions using Google Analytics (part 2)

Update: I just posted (December 4th, 2008) a version that will allow you to differentiate between 1.6.0* the family versus 1.6.0 the version.

I'm experimenting with a new script for tracking Java versions. To use the new code simply add the following two lines after your Google Analytics script:


<script src="http://java.com/js/deployJava.js" type="text/javascript"></script>
<script src="http://jre-analytics.googlecode.com/svn/trunk/jre-analytics.js" type="text/javascript"></script>
I encourage you to sign up to the mailing list to follow future discussions on this topic: http://code.google.com/p/jre-analytics/

Benefits of new script
  1. Easier, auto-updating installation. Linking to my external script means that you get the benefit of future updates without any effort on your part.
  2. Does not conflict with other scripts. The old code uses _setVar() which records at most one variable across an entire user session. Different scripts compete for exclusive access to this variable. The new code uses _trackEvent() which allows multiple values to be recorded in separate namespaces, so different scripts do not interfere with each other's data collection.
  3. Records multiple JRE versions per user. The old script was supposed to do this but the limitations of _setVar() meant it only recorded the latest JRE version.

Details


About 48 hours after you install the script you should see new data under Content -> Event Tracking. Please note that the Event Tracking menu will not show up until you collect enough data.

Please let me know the statistics reported for your site. Post this at http://forums.java.net/jive/thread.jspa?messageID=317425

The new script will record two kinds of events:
  1. detected: indicates whether Java was detected on the user's machine.
  2. version: indicates the specific Java version detected on the user's machine.
This should give you a much better overview of what's really going on. I look forward to your feedback!

Warning

According to http://code.google.com/apis/analytics/docs/eventTrackerGuide.html both the old and new script will cause your page's "bounce rate" to incorrectly get reported as zero. This is a limitation of how _setVar() and _trackEvent() are implemented and there doesn't seem to be anything I can do about it. Sorry :(

2 comments:

Unknown said...

Gili, I've installed jre-analytics on my own website yesterday. Today I already have reports in the events sections without to have to apply as a Google Analytics "trusted tester".

I've made a post on my blog about jre-analytics : http://www.tekool.net/blog/2009/01/23/java-jre-version-penetration-stats-with-google-analytics/



Thanks for your script.

Gili said...

@Tek,

Thanks for letting me know. I've removed the "trusted tester" section of the blog.

With respect to the statistics it's funny how some people see the glass half empty and others see it half full. I was actually quite happy to find out that Java had at least 75% market penetration. It is also worth noting that this script does not detect *all* JREs (for example, non-Sun JREs or Linux JREs are not detected) but it's probably "good enough" because most Windows (i.e. desktop) users use Sun's JDK.