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.