Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaying Number of visitors?

Status
Not open for further replies.

budgy

Programmer
Jan 4, 2005
73
GB
Hi guys, I really hope you can help me here, im in the process of designing a new site, and one of the requirments is that the number of visitors on that site is displayed on the page. I understand there is javascript that could be used to solve this requirment. But any suggestions and advise would be much appreicated.

Thanks in advance


"He that asks a question is a fool for a moment, he that never asks a question is a fool all his life
 
I understand there is javascript that could be used to solve this requirment
Uh-uh. No.
JavaScript is client-side - you need something server-side.

Google 'Hit Counter' or 'Hit Counter Scripts' - you'll find millions to implement.

<marc>
 
Hey, thanks for that, but its not a hit counter that i require, but a counter that records how many people are currently viewing the site.

Thanks again.

"He that asks a question is a fool for a moment, he that never asks a question is a fool all his life
 
You still need something server-side to show you the number of active sessions.

Are you using ASP? ASP forum (Forum333)

Tony
[red]_________________________________________________________________[/red]
Webmaster -
 
Ah, apologies - I misunderstood.

The issue with this is that HTTP is stateless - once the page has been 'got', the connection with the visitor is lost.

Most scripts achieve what you're asking for by starting a session when the visitor gets to a page, and counting the open sessions. You count a visitor as 'gone' when they either clock into another page on the site (and the session continues on another page), or the session times out (at whatever interval you wish to set - perhaps 5 minutes?).

Either way, you're looking at server-side code, rather than client side.

A client-side script/plugin could help get a more accurate count, by maintaining a connection after the page has been 'got' - but this would be at the expense of increased bandwidth and complexity; most developers find the slight increase in accuracy unnecessary.

<marc>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top