Using localStorage for pagecount hits
<p>For the life of me I can’t figure this out grrr and wondering if someone could help…</p>

<p>My son is doing some html homework. We’re trying to put a page counter that will count and display the number of hits to a page. He’s got an index and three other pages. I’ve put this on each page:   </p>

<pre><code>&lt;div class="page-count"&gt;
  &lt;script type="text/javascript"&gt;
      if (localStorage.pagecount)
        {
        localStorage.pagecount=Number(localStorage.pagecount) +1;
        }
    else
      {
        localStorage.pagecount=1;
        }
    document.write("You've had "+ localStorage.pagecount + " hits.");
  &lt;/script&gt;
&lt;/div&gt;
</code></pre>

<p>Problem is it counts all of the hits together rather than how many hits per page… how could I get this to count the hits on a single page rather than how many hits in total? </p>

<p>Thanks in advance. </p>