Website visit counter in JavaScript

T

TomCat

Hello,

can anyone send me a link or even some sample of script that counts visits
to a website ?

Thanks,

TomCat
 
K

kaeli

T

Thomas 'PointedEars' Lahn

TomCat said:
can anyone send me a link or even some sample of script that counts
visits to a website ?

No. A visible website counter serves no purpose, not even the intended
purpose of counting visitors. It can count downloads, not visitors, if
that (consider proxies and client-side caches). Get a proper access log
evaluation tool, installed server-side, and most certainly not implemented
with server-side JS.


PointedEars
 
T

Thomas 'PointedEars' Lahn

Tony said:
Actually, a visible website counter CAN count unique visitors, based on IP
address.

No, it cannot. Even if not connected via a proxy (which would
be the IP address logged), a computer is a machine that needs
not to be used by only one person at a time.

Visible Web site counters in fact serve no purpose but posing
(or the opposite, depending on the counter value at visit) but
they introduce several problems:

1. they increase network load and bandwidth usage (unnecessarily)
2. they waste computing time and increase server load
3. they slow down document rendering, especially on
intensive server load (continue with 2.)

Thus are not used by any professional commercial Web site.
You may want to use Google to find that my opinion is not
that uncommon among reasonable/professional Web authors.
It's not perfect, but neither are many access logs, for the same
reasons.

Logs can at least provide statistically evaluatable information
about specific resource access. Nothing more can be determined
reliably if not requested in a representative strawpoll; that
includes used browser, languages aso.


PointedEars
 
T

Thomas 'PointedEars' Lahn

Tony said:
But that is still more significant than simple hits/downloads,
as you said.

I did nothing of the kind.
Also, the same IP address can be used for more than one computer, if
they're dynamically allocated.

Yes, of course.
PLUS, one user could be using more than one computer at different
locations, thus one user has two unique visits logged.

They're not perfect, but they can do more than just counting the
number of times a page is downloaded.

So your argument is:

"Yes, my bike having rectangular wheels is not easily rided and most of the
time it is borken, yet it works quite well if it sometimes happens that
there are rectangular-shaped holes in the street."

Great core dump!
I didn't get the impression this was for a professional, commercial web
site.

The point is that features not used on professional commercial Web sites
but largely on newbie private Web sites indicate low-quality features.
Nobody reasonable makes business with people who obviously do not
understand their business and the needs of their customers.
Unless you use persistent cookies or some other similar means to identify
each visitor,

There is no such thing as a persistent cookie. Cookie management is up
to the user.
you can't get much more info about who, uniquely, visits your site. And
even such methods have their drawbacks, given that (once again) more than
one user can use the same computer, a user can delete their cookies, etc.

Yes, just as I wrote, thanks for confirmation. It is neither desirable
nor possible to evaluate anything other than specific resource access and
so having the chance to review the concept of the Web site based on a
reliable statistical basis.
Proper tool for the proper job.

Web counters are not tools, they are an (increasing) annoyance.
I have a couple simple sites that I just want to be able to get
an idea how much it's being visited. A hit counter is fine for that.

No, it is not, for the reasons already presented.
I have no need for access logs for such pages.

Your problem if you only have one home page you want to edit based on bogus
data you collect by annoying visitors. I maintain Web sites (consisting of
several documents) where I need reliable information about without annoying
visitors (because, among others, that would bias the collected data).

PointedEars
 
T

Thomas 'PointedEars' Lahn

Tony said:
No, my argument is that it's pointless for someone running a small
personal or hobby site to resort to full-blown logging.

That logging does not need to be "full-blown" (whatever you want to
imply with that), it can be reduced to what is needed and still provide
reliable unbiased data, i.e. which document has been accessed when and,
following from that, how often it has been accessed within a certain
span of time.

Good point. I wouldn't "make" business with someone who tried to
sell me a Ferrari when a Geo Metro suits my needs.
Exactly.

The first aspect of good business is to understand your customers
needs - NOT to sell them what you prefer. Just because full-blown
logging systems are good for some businesses doesn't mean that
they're even appropriate for other applications.

Do you disagree with that?

Yes. You have a misconception about who is the customer here.
Hint: it is _not_ the author/Web master.
I see, so my personal site with pictures of my kids, that I want to
get a ROUGH idea how many different people check it out, and how
often it's visited, should use a full-blown logging system instead
of a simple hit counter?

As I said, a) your data is biased for several reasons (including the
until now not mentioned fact that client-side script support and image
support can be disabled or not even present) and so can *not* even
provide a rough idea of what you seek to determine. Instead, it
additionally annoys visitors. b) Logging can be easily configured.

Now what would be the more reasonable approach, provided that you want
to attract *more* visitors rather than less?
And you are assuming that I don't?

Well, if you maintain at least one Web site not constisting of only a
single document you would need to add an annoying counter to every
document for an supposed-to-be equal result and still collect biased
data.

But, since Web counter back ends are not implemented using client-side
scripting and seldom, if ever, using server-side JS, I suggest we either
continue discussion elsewhere (comp.infosystems.www.authoring.misc?) or
end it.


PointedEars
 
R

Randy Webb

Thomas said:
:




That logging does not need to be "full-blown" (whatever you want to
imply with that), it can be reduced to what is needed and still provide
reliable unbiased data, i.e. which document has been accessed when and,
following from that, how often it has been accessed within a certain
span of time.

No it can't. It can only tell you that data about the *server*. It can
not tell you how many times it was retrieved from a proxy/cache which
makes the logs just as un/reliable as hit counters.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top