title: How to debug Google Analytics Tracking error (_gaq.push returns '3')
body: <p>SUMMARIZE:</p>
  
  <p>I misunderstood the usage of content script. And that leads to this issue. Here is a quote from Google's official doc:</p>
  
  <blockquote>
    <p>Execution environment</p>
    
    <p>Content scripts execute in a special environment called an isolated
    world. They have access to the DOM of the page they are injected into,
    but <strong>not</strong> to any JavaScript variables or functions created by the page.
    It looks to each content script as if there is no other JavaScript
    executing on the page it is running on. <strong>The same is true in reverse</strong>:
    JavaScript running on the page cannot call any functions or access any
    variables defined by content scripts.</p>
  </blockquote>
  
  <p>More details:
  <a href="https://stackoverflow.com/questions/11372107/content-script-tracking-with-google-analytics/12985606">Content Script tracking with Google Analytics</a></p>
  
  <p>--</p>
  
  <p>I am adding some tracking code into a Chrome Extension. But when I test it, the _gaq.push returns number 3. As I tested, I figured that if I call _gaq.push in the extension, the number will keep rising. But when I call it in the console, it's all fine (all the same code).</p>
  
  <p>I am wondering how I can do to track deeper into this error?</p>
  
  <p>Thanks very much for every answer!</p>
  
  <p>UPDATE:</p>
  
  <p>When I trace the return value of _gaq, it is still an array. That means ga.js is not loaded, right?</p>
  
  <p>But it seems ga.js is never loaded in my script. Unless I manually type _gaq in the console, it's an object. This is very weird.</p>
  
  <p>I checked the DOM and found that  tag is already added.</p>
  
  <p>I reviewed the Network panel, find that ga.js is not loaded at all in the queue. But why I can still use console to access the _gaq object?</p>
  
  <p>UPDATE2:</p>
  
  <p>I use console.log to track the value of "window._gaq" and found that the return value of console.log(window._gaq) is DIFFERENT than directly type "window._gaq" in the console. It's totally two different objects. I even use a setInterval function to log the results and it's keeping returning the array, not the expected object.</p>