Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Time spent

edited April 2007 in Vanilla 1.0 Help
It would be neat to have a place on the users profile to measure how much time they spend on the site. Perhaps 2 lines: 1 to show how much time they have been on the site today, and 2 total time spent on the site. Not sure how you would go by measuring this though.

Comments

  • just a suggestion: timestamp cookie. fifteen min expire time. every time you remake the cookie, a value in database for the user goes up with 0.25. This number will be the total number of hours spent.
  • I believe Javascript has some window load/unload events that you can send ajax messages to a function on the server that tracks time spent... but I don't know anything about how to use them.

    Doesn't mint do this? Or if you don't want to pay $30, maybe the ShortStat add-on does?
  • Hmm I have mint.. didn't know it did this, I'll have to look into it. Thanks WallPhone.
  • Turns out it wasn't Mint, but Google Analytics. Google Analytics computes it by calculating the amount of time that occurs between page requests, with the exception of the last request, which is simply not included in the calculation. Not a perfect metric, and I suppose its rather imperfect by nature since power users would have several tabs/browsers open but not be reading them all at that time. Maybe the best way to do this would be save the last time a login or cookie authetication occurrs in the users table and the next time the user logs in, subtract that from the time of the last visit (could easily assume this is the latest record timestamp in the UserDiscussionWatch table) and then add that into a 'time spent' column on the user's table. You could even do better than google's method accuracy-wise by counting the page views since login and figure the average page view time as an estimate of the last page view time.
This discussion has been closed.