title: Getting Google Analytics to see a test server
body: <p>I have a conceptually simple problem involving Google Analytics and Tomcat, but I cannot solve it.   </p>
  
  <p>We have Google Analytics set up for our production machine and it is working fine.   I want to set up a Google Analytics account to monitor our test system so I can test various features without affecting/polluting our production data.   I have a test system set up, and a test Google Analytics account.   However, the test Google Analytics account never receives data from the test system.  </p>
  
  <p>From my investigation, it appears that the problem is that my test system is being referred to as "localhost" instead of "test.mycompany.com" and the document.domain property used by Javascript is therefore "localhost" instead of the "test.mycompany.com" URL that it should be.   This is causing the Google Analytics cookies to be written incorrectly (I think) and therefore the Google Analytics Javascript code is never sending data to my Google Analytics account.  </p>
  
  <p>Is there any way to set this "document.domain" property in Tomcat 6 so that this system will think it is "test.mycompany.com" instead of "localhost"?   </p>
  
  <p>I have examined both the Tomcat docs and the Google Analytics docs, but neither of them address this point directly.</p>
  
  <p>Any help would be appreciated.</p>