Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

session count

 
raj sekhar
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to build a session count component which tracks the users and the no of hits by the same user for a single page.
wondering if there is a way that I can ask the webserver to neglect repeated hits by the same user on the same day...
I wud like to take into account only the unique hits for any given day...!
Any suggestions
Thanks
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

on a side note - what is your definition of unique hit?
Remote IP address?
or a Session Id or something else?
could you pl. clarify on this
- satya
 
Gagan Indus
Ranch Hand
Posts: 346
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Raj

many solutions possible . Not aware of any webserver support for this
one of which i think is :
( but it require u to check bforehand ,dat client accepts cookies )
( i hav posted a relative query here : http://www.javaranch.com/ubb/Forum18/HTML/000359.html )

  • Upon user registeration/recoginition, Make n send two cookies to client :
    [list]
  • One of 60*60*24 time-length
  • One umlimited time length
  • In ur doPost/doGet method , check if client request comes wid first cookie :

    • if yes , then do not increase today's user hit , as client have already visited this page in last 24 hours
    • if no , then check if request comes wid second cookie :
      [list]
    • if yes , then user is old user . Increase its hit count for today and reset 60*60*24 cookie.
    • if no , then user is brand-new one , Set Both cookies for this user , do its entry in databse etc and also increase its counter.
    • [/list]
      [/list]
      ------------------
      Gagan (/^_^\) SCJP2
      Die-hard JavaMonk -- little Java a day , keeps u going .
 
raj sekhar
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys for the reply
Madhav
Unique=new user not necessirily a fresh IP
Once a user logs in today,I dont want his count to increase in the same day...and yes, I want the number of users who visited that particular page for a given day!!
any simple?
Gagan....I did go thru your solution very briefly but will come back soon...Meanwhile, if you have a better alternative...shoot out.I can try out !
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic