Javascript hit counter for a website
Using Javascript you can only count the hits from the current user, because you have to save the count in a cookie or a client side technology.
For a more accurate way you have to use a server-side language and maybe add a storage engine like a database to make it work.
I suggest you start here Php for beginners the link might be old but it covers all the basics you need to know to create your counter.