title: What is the correct syntax for adding a custom cookie in Google Analytics?
body: <p>Google's own site seems to provide conflicting documentation.</p>
  
  <p>I've found at least 4 variations for adding A custom cookie to GA.</p>
  
  <p><a href="http://www.google.com/support/forum/p/Google%20Analytics/thread?tid=6a452bd09455721a&amp;hl=en" rel="nofollow">http://www.google.com/support/forum/p/Google%20Analytics/thread?tid=6a452bd09455721a&amp;hl=en</a></p>
  
  <p><a href="http://code.google.com/apis/analytics/docs/gaJS/gaJSApiBasicConfiguration.html" rel="nofollow">http://code.google.com/apis/analytics/docs/gaJS/gaJSApiBasicConfiguration.html</a></p>
  
  <p><a href="http://www.google.com/support/forum/p/Google%20Analytics/thread?tid=4362f4d46e6e723a&amp;hl=en" rel="nofollow">http://www.google.com/support/forum/p/Google%20Analytics/thread?tid=4362f4d46e6e723a&amp;hl=en</a></p>
  
  <p><a href="http://analytics.blogspot.com/2009/07/segment-your-traffic-with-user-defined.html" rel="nofollow">http://analytics.blogspot.com/2009/07/segment-your-traffic-with-user-defined.html</a></p>
  
  <p>Here is the code I currently have embedded in my company's sharepoint site.  I'm beginning to think that this will not work, and that I will have to create an "employee.html" page on my public webserver that I will have to request all employees load once to generate the cookie on their PC's.  My secondary question, is after I setup a employee.html page as the example <a href="http://analytics.blogspot.com/2009/07/segment-your-traffic-with-user-defined.html" rel="nofollow">http://analytics.blogspot.com/2009/07/segment-your-traffic-with-user-defined.html</a> here describes, how do I keep all the external traffic from accessing that same page?</p>
  
  <pre><code>    &lt;script type="text/javascript"&gt;
  
      var _gaq = _gaq || [];
      _gaq.push(['_setAccount', 'UA-20842347-1']);
      _gaq.push(['_setCustomVar',1,'visitor-type','employee']);   
      _gaq.push(['_setDomainName', '.sc-pa.com']);
      _gaq.push(['_trackPageview']);
  
      (function () {
          var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
          ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
          var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
      })();
  
  &lt;/script&gt;   
  &lt;/HEAD&gt;
  </code></pre>