aspose file tools*
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 Soft Skills this week in the Jobs Discussion 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
Author

How to find number of visitors for my website?

Gaurav Pravin Dighe
Greenhorn

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.


Regards,
Gaurav Dighe
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42919
    
  68
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
Greenhorn

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 agree. Here's the link: http://aspose.com/file-tools
 
subject: How to find number of visitors for my website?