View Full Version : Webpage hit counters

12-29-2005, 12:00 PM
Hi everyone,

My name is Michelle. I am currently learning JavaScript (I'm very new to it). I've learnt html but not xhtml.

Anyway my question is :

Can website hit counters be built with JavaScript? I really want one for my homepage but don't want the free ones that have advertising etc.

Does anyone have the code for it that I could use?
I would really appreciate it.


12-29-2005, 12:15 PM
Please observe the forum rules (http://www.codingforums.com/rules.htm): no crossposting (http://www.codingforums.com/showthread.php?t=75791).

12-29-2005, 01:41 PM
Michelle ...

I'll reply here instead of the Javascript section because I think your
question goes here. It can't be done with Javascripting.

With Javascripting, the only thing that can be saved is cookies ... and that
would be on the visitor's PC, not your webhost diskspace.

You need to use a server-side language such as PHP or Perl. It would be
a good learning experience to look into and and try your hand at it ...

but, hit counters really don't mean anything anyhow ... nobody really cares,
or believes the number they see. You should try to do something else with
Javascripting. Maybe learning how to use cookies might be a nice thing
to know.

Do a search on Google for: Javascript Cookies Tutorial

12-29-2005, 02:06 PM
Although mlseim basically covered it, here's a thread from the PHP forum that comes close: Link hit counter (http://www.codingforums.com/showthread.php?t=59805&highlight=counter).

A page hit counter should be invoked differently, but most of the leg work comes close enough.