Fotiman - 2:04 pm on Oct 9, 2012 (gmt 0)
// This code is NOT in the global scope
That is an anonymous function that executes immediately. The vars declared within that will not be global, and generally it's best to avoid creating global variables so you're not dirtying the global namespace (in which case you run the risk of conflicts, etc.).
Would the functions and variables in the secondary script already be kept separate from the first script?
In your example, the g and s variables are only used for the purposes of loading another script. That is, no other code ever references those, so keeping them out of the global scope is a good thing. The script that gets loaded might add more variables to the global scope, or it might do something similar and wrap it's contents in a self executing anonymous function. The only way to tell is to look at the actual script (but ga.js does wrap the contents in an anonymous function). :)