title: Using Cookies to track number of visits to a site with Javascript/Ajax
body: <p>First I will start off by saying I'm a newbie in Javascript and I'm trying to track this information for a website I created.</p>
  
  <p>I want to create a cookie called "counter" and track the number of times a user has visited the page. I have set up an input with an id="counter" where I want to display this number. By default the number will always be set to "1" even if the user has never visited the page. Lastly, I want the cookie to expire a year from that date however I think I may have solved that on my own. Please let me know if I messed that up!</p>
  
  <p>I would really appreciate it if I can get ideas on how to write this code or examples doing the same thing I'm trying to do. Thanks </p>
  
  <p>Making the cookie expire in one year from the current date:</p>
  
  <pre><code>    var expiry = new Date();
  
      expiry.setTime(expiry.getTime()+(365*24*60*60*1000));
  </code></pre>