Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
97
rated 0 times [  102] [ 5]  / answers: 1 / hits: 20511  / 12 Years ago, wed, july 25, 2012, 12:00:00

I'm trying to code a hit counter for a website. As a preference, not required, I'm trying to use Javascript to do this. On the website's html file, I'm reading a number from a javascript file and outputting that. How can I make it count every time a hit occurs?



Sorry for such a vague question. Am I on the right track going about this? Any tips, code, or references will be much appreciated.



Thanks!


More From » javascript

 Answers
9

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.


[#84046] Tuesday, July 24, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
luizc

Total Points: 623
Total Questions: 87
Total Answers: 103

Location: Zimbabwe
Member since Sat, Feb 27, 2021
3 Years ago
;