473,785 Members | 2,219 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Website visit counter in JavaScript

Hello,

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

Thanks,

TomCat


Jul 23 '05 #1
11 9086
In article <d5**********@s unce.iskon.hr>, op*******@mail. inet.hr enlightened
us with...
Hello,

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


This is not commonly implemented with client-side script for a variety of
reasons.
Why do you want that?

Google page counters to find tons of the things, free and otherwise.

--
--
~kaeli~
Cthulhu saves our souls and redeems them for valuable
coupons later.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #2
TomCat wrote:
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
Jul 23 '05 #3
"Thomas 'PointedEars' Lahn" <Po*********@we b.de> wrote in message
news:19******** ********@Pointe dEars.de...
TomCat wrote:
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.


Actually, a visible website counter CAN count unique visitors, based on IP
address. It's not perfect, but neither are many access logs, for the same
reasons.

I have some personal sites that are hosted on my ISP, which doesn't support
any server-side processing. When I want a hit counter, I use a free
hit-counter service like www.amazingcounters.com (or google "free hit
counter") - they're server-side - the service's server: you add them to
your page by simply inserting an <img> tag.

Downside to free counters - they're advertiser-driven, so you have to have
the ad link on your counter. No big deal for the stuff that I was counting -
It's up to the OP to decide if that's acceptable.
Jul 23 '05 #4
Tony wrote:
"Thomas 'PointedEars' Lahn" <Po*********@we b.de> wrote [...]
TomCat wrote:
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.


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
Jul 23 '05 #5
"Thomas 'PointedEars' Lahn" <Po*********@we b.de> wrote in message
news:18******** ********@Pointe dEars.de...
Tony wrote:
"Thomas 'PointedEars' Lahn" <Po*********@we b.de> wrote [...]
TomCat wrote:
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.
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.


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

Also, the same IP address can be used for more than one computer, if they're
dynamically allocated.
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.
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.
I didn't get the impression this was for a 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.


Unless you use persistent cookies or some other similar means to identify
each visitor, 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.
Proper tool for the proper job. 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. I have no need for access logs for such pages.

A high-volume commercial website is another matter entirely, and would be
handled as such.

I mean, you wouldn't use a bulldozer to dig a hole to plant flowers in,
would you?
Jul 23 '05 #6
In article <11************ *@corp.supernew s.com>, so*****@somewhe re.not says...
Proper tool for the proper job. 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. I have no need for access logs for such pages.

Get yourself one of the hundreds of free counters and save yourself
the time and headaches.
Jul 23 '05 #7
Tony wrote:
"Thomas 'PointedEars' Lahn" <Po*********@we b.de> wrote [...]
Tony wrote:
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.


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!
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.


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.
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.


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
Jul 23 '05 #8
"Thomas 'PointedEars' Lahn" <Po*********@we b.de> wrote in message
news:17******** ********@Pointe dEars.de...
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."


No, my argument is that it's pointless for someone running a small personal
or hobby site to resort to full-blown logging.
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.


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

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?
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 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?
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).


And you are assuming that I don't?

Jul 23 '05 #9
"Tony" schrieb:
"Thomas 'PointedEars' Lahn" <Po*********@we b.de> wrote [...]
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."


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.

<http://httpd.apache.or g/docs-2.0/logs.html>
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.


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.
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 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?
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).


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.infosyste ms.www.authoring.misc?) or
end it.
PointedEars
Jul 23 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1506
by: marks542004 | last post by:
Hi, sorry if the title is confusing. I regularly visit a website whicg is a specialist website for custom engineering products. The website puts up a banner ad about specials available from associated businesses using my specific town name. (example: Get your referance Books from Bookworld, xxxxxxx (my town name)) Most of the time these make no sense whatever because my town is less
3
1796
by: stephenmarron | last post by:
Hi Everyone, I am having trouble looking for a script that will rotate images from a standard text file. I have a folder set up with two images that rotate every time the page is refreshed. They also have a hyperlink so that when an image/ad is clicked on it goes to the advertiserments web address. The only problem is that the path to the images and corresponding hyperlink are in a javascript file.
6
1614
by: Michael Landberg | last post by:
Hi I am crewating a website using HTML and Javascript. The website can be seen by everybody that has internet. Do I have to consider that some people don't have javascript enabled in their browsers?? I mean If someone has disabled javascript they wont see some part of the website. Regards
32
4284
by: Ciaran | last post by:
Hi I've seen this a few places - The site lists off the number of people (not logged in) currently browsing the site. How can I do this with php / mySQL please?
3
6439
by: Dev | last post by:
Dear All, i have get combination of four PHP script for count the visitor of website but when i apply all these i have no answer. i am posting the code of all four PHP script below. CODE OF INDEX.PHP <?php print "<font face='verdana' size='1'>";
9
2254
by: Pygmalion | last post by:
I have found dozen of useful PHP counters on the web. However, nobody is working for my web pages, since administrator does not want to enable the possibility that PHP could be called from HTML. (i.e. "Addhandler application/x-httpd-php .html .php" in .htaccess). He says it is a security problem. Is it possible to make a PHP counter WITHOUT using echo command? Thanks for your suggestions,
19
3316
by: Ganesh J. Acharya | last post by:
Hi there, I want to redesign my website and make that look professional. I made this about 6 years ago with very little knowledge of internet. Today I am getting about 4000 visitors a day for the same. What are the things I need to keep in my mind when doing this process.
3
3098
by: DavidPr | last post by:
I made a website for a group of people and they want a visitor counter on it. I don't like hit counters because if the site is dead everyone will know it. But, it's their website. I did an Internet search but didn't find exactly what I was looking for. I did find an old tutorial, from which I've pasted the code below. I need it to be session controlled and I only want it to count unique visitors. I want to use a database to keep track of...
0
9646
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9483
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10157
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7504
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6742
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5386
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5514
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4055
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2887
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.