Log in

View Full Version : Hit Counter



Jay Dog
10-14-2013, 03:35 PM
Hi, again I've been asked to modify the school website and one of the things they've asked for is a Hit Counter.

I've found some free ones online and they seem to be doing the trick but they do have an advert to their webpage which isn't too much of a problem but I'd prefer one that's just ours and not linked to another site.

I've done some research and found one Javascript based Hit Counter which worked in Dreamweaver but when I put it online it didn't work.

Anyone know of a simple code I can just import into a webpage or are the free ones online the best and easiest option?

Thanks,



Jay Dog

jscheuer1
10-25-2013, 04:07 AM
If the school's website's host has server side code like PHP available, a simple hit counter could be made that would update a file with a number. That number could be private for your viewing only or could be shown on the page. What hits are you counting? The number of people who land on the home page? Something else?

djr33
10-25-2013, 05:10 AM
JS alone can't do this: that'll just save the information locally (based on you viewing the website). In fact, that's an odd idea in the first place (so I'm not sure why DW includes it). As John said, this can be done relatively easily.

If you don't have PHP (or another serverside language) there is a way around this, which is by using an image that is generated dynamically and tracks how many times the image [not the page] is loaded. That's probably what the scripts you've already seen do; you could do the same (but of course you'd need a second server with a serverside language like PHP for that to work).

"hit counter" is such a common thing that you can keep looking and you'll probably find some without ads. I imagine there are thousands out there (just the free ones). It might not look exactly like you want, in which case you'd want to switch to something you can control (with a serverside language like PHP). Note that some free ones will work with serverside languages too. You could start here for example:
https://www.google.com/search?q=php+hit+counter