title: Google Analytics - Setting 'ga' cookie domain to '.www.example.com'
body: <p>This is how the cookie domain is usually set in Google Analytics's tracking code. I understand <code>auto</code> and <code>none</code> are the other two options.</p>
  
  <p><code>ga('create', 'UA-45015643-1', 'example.com');</code></p>
  
  <p>The above code, which is a part of Universal Tracking code, sets the cookie domain to <code>.example.com</code>.</p>
  
  <p><img src="https://i.stack.imgur.com/T1vhC.png" alt="Cookies when viewd in EditThisCookie chrome extension"></p>
  
  <p>Setting cookie domain to <code>.example.com</code> makes cookie accessible to all of its subdomains. But I have set up a cookie-free domain <code>http://static.example.com</code> to download static contents and I don't want cookies to be sent along with this type of static resource request. So, I tried this:</p>
  
  <p><code>ga('create', 'UA-45015643-1', 'www.example.com');</code></p>
  
  <p>This resulted the cookie domain to be set to <code>.www.example.com</code>. The tracking was working fine after this update (I used Realtime view to verify), apparently.</p>
  
  <p>But I want to be sure if this actually have no side effects or is not a bad practice.</p>