title: javascript - Detect if Google Analytics is loaded yet?
body: <p>I'm working on a project here that will store some info in Google Analytics custom variables. The script I'm building out needs to detect if GA has loaded yet before I can push data to it. The project is being designed to work across any kind of site that uses GA. The problem is reliably detecting if GA has finished loading or not and is available.</p>
  
  <p>A couple of variabilities here:</p>
  
  <ol>
  <li><p>There's multiple methods of loading GA. Older scripts from the Urchin days up to the latest asynchronous scripts. Some of these are inline, some are asynchronous. Also, some sites do custom methods of loading GA, like at my job. We use YUI getScript to load it.</p></li>
  <li><p>Variable-variable names. In some scripts, the variable name assigned to GA is <code>pageTracker</code>. In others, its <code>_gaq</code>. Then there's the infinity of custom variable names that sites could be using for their implementation of GA.</p></li>
  </ol>
  
  <p>So does anyone have any thoughts on what might be a reliable way to check if Google Analytics is being used on the page, and if it's been loaded?</p>