title: How does Google Analytics save data to a database
body: <p>I am making a Google Analytics like project for my school assignment. I have two questions primarily:</p>
  
  <p>1) Exactly when does Google store the data to the database? When it does it use XHR with some server side scripting language to store it to the database or is there a way to do it using plain javascript?</p>
  
  <p>2) How do I get the IP address of a user from Javascript? How does Google do for Analytics??</p>
  
  <p>Thanks for all the help.</p>
  
  <p>Pranz</p>