Preventing closure compiler from renaming certain variables

Posted by phidah on Stack Overflow See other posts from Stack Overflow or by phidah
Published on 2010-06-11T20:00:58Z Indexed on 2010/06/13 0:42 UTC
Read the original article Hit count: 699

I have a javascript file with a global object that must not be renamed (_gat from the Google Analytics async tracker).

This object must not be renamed by the Google Closure Compiler as Google Analytics looks for a variable with this specific name.

I've looked into the Javascript Doc notations that are mentioned: http://code.google.com/closure/compiler/docs/js-for-compiler.html - However, I cannot find anything regarding the "protection" of a variable.

The problem exists no matter if I use simple or advanced compilation.

How can I ensure that the _gat variable is not renamed?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about compression