English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

My company has asked me to take over managing the website, and I've been streamlining the page and cleaning up the code and such. I'm no HTML guru, but I do the coding myself rather than using FrontPage. My boss has asked me to put a counter on the homepage, but all the searching I've done for information on how to add a counter has just resulted in websites that have "free" counters that are tracked on their page. I want to have control over the counter myself and don't really want another website monitoring our usage and possibly creating pop-up windows in the background. A text counter would be fine, if I could just make a .txt file that has a raw number in it, and some javascript that adds 1 to it and displays the number on the page. Unfortunately I don't have a clue how to actually do that since I know nothing about writing scripts myself. Any suggestions where to look?

2007-04-02 04:56:04 · 4 answers · asked by Stephen K 2 in Computers & Internet Programming & Design

4 answers

You can use the free scripts from Matt's Script Archive:

http://www.scriptarchive.com/textcounter.html

http://www.scriptarchive.com/counter.html

These scripts require you to be able to use PERL. Most Linux and Windows hosts have this option available. Ask your Web host for assistance.

Also, your Web host may have this as an option in your Web site's control panel.

2007-04-02 06:46:36 · answer #1 · answered by Anonymous · 0 0

You'll have to have a program (PHP, ASP, CGI, etc. that runs on the server. It'll have to keep track of a number *there* because it'll have to remember where you (on a computer in, say, Happytown, NY) and then I (in, say, Happytown CA, across the country) hit your website, because a *client-side* javascript on your computer won't know that I'm hitting the website at the same time...)

At any rate, a website counter has dubious value, because, think about it: I hit your home page and the counter goes up one, then I go to your second page, then I click Home from there, and the page counter goes up one more, then I click your link from either page to another site, and click the back arrow to your Home page and the counter goes up one more...deceptive, que no?

2007-04-02 05:07:40 · answer #2 · answered by fjpoblam 7 · 0 1

Add this to the area of the page:





and add this to the body where you want the counter to appear:

You have visited this page

times.

For fpjoblam: if you took a second to look at the code I provided, you'll notice that it relies on a cookie which pre-empts multiple hits from the same person. Your arguement is also not valid because it's javascript and runs locally, not on the server so no cgi or anything else is necessary.

2007-04-02 05:03:42 · answer #3 · answered by John S Wiggins 4 · 0 1

In your global asa page.

-Initiated an application session variable in the app start event.
application("PageHits") = 0
-in the session start event add 1 to the counter.
application("PageHits") = application("PageHits") +1
-on the page you want to display the count, use the application("PageHits").

The link provides a means to eliminate duplicate visits from the same IP.

2007-04-02 05:00:38 · answer #4 · answered by Ustes G 2 · 0 1

fedest.com, questions and answers