jsdomenu versus Google Analytics

I repost some of my blog posts made @ liip. Please see here for the original post and comments: blog.liip.ch/archive/2008/01/15/jsdomenu-versus-google-analytics.html

Recently, one of our customers had a problem with google analytics. When he opened his web site with the Site Overlay feature, he just got his normal web site with no overlayed user data. The first thing to notice when trying it myself (with Firefox) was that javascript stops with an error. The error console said "opera.version is not a function" in https://www.google.com/analytics/reporting/overlay_js?gaso=...

Strange that the Google javascript should contain an error! The Google script was very compact, so I used the Javascript Formatter to make it readable. There is indeed a line testing whether opera = 'undefined'. If it is different from 'undefined', the script tries to use the opera.version field. So why would opera be defined in my Firefox browser?

I did a grep over all javascript folders for the name opera. It revieled that a certain jsdomenu.js contained that name. Jsdomenu is an old and unmaintained library for creating dynamic navigation. I would not recommend to use it, but for the legacy application at hand, replacing it would not be too much effort.
The script defines the variable opera (and firefox and ie) to test later on which browser is executing it to use specific code. As expected, the variable was set to false. However, opera seems to provide some information about itself in an object named 'opera'. Google compares the opera variable with "undefined" - but false is of course not "undefined". I guess it is better not to use that name as variable, as it would probably break any script relying on the opera object when running under Opera.

The fix was to rename that variable to jsdoopera in all occurences. Now Google Analytics works.

For comments, please go to the original post in the liip blog: blog.liip.ch/archive/2008/01/15/jsdomenu-versus-google-analytics.html