jQuery in Action, 3rd edition
The moose likes Servlets and the fly likes How to find number of visitors for my website? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to find number of visitors for my website?" Watch "How to find number of visitors for my website?" New topic

How to find number of visitors for my website?

Gaurav Pravin Dighe

Joined: Jun 12, 2011
Posts: 23

I need to find how many visitors visited by website and display it on my website as "Total Number Of Visitor: ####". I am not looking for database approach.

I am thinking of using Listener Classes and Interfaces, but i don't have any idea.

Please help.

Gaurav Dighe
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42958
Start by defining what a "visitor" is. It's easy to count how many sessions get created - if your web app creates a session for every visitor. It's also easy to count how many times a particular web page is accessed - but each visitor might access a particular web page more than once. So think about what you want to count as a "visitor".
Kartik Mavani

Joined: May 21, 2013
Posts: 5
It's a very open ended question.
Now if you say you just want the counter, define a static variable and keep on incrementing that variable. But if you go via this approach then you will have to take care of the IP addresses from which the request is coming.
The reason that I am saying about the IP addresses is say you hit the index.jsp from your machine 10 times then that should not increment the counter to 10. Perhaps you can look at Google Analytics.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: How to find number of visitors for my website?
It's not a secret anymore!