Do you find that users tend to consistently click 'log out' on your site, or are they more likely (this is my guess) to simply close the browser window, without clicking on 'log out'? (Because the user_loggedout event is only triggered if a user actually clicks 'log out').
Also, how do you define time spent?
Is it the time that the server
, but what about if they opened multiple tabs, do they all count as time spent, so you could open 5 tabs and build up 5 times as much time spent?) Or is it something to do with the time between clicking on pages? (User opens up Moodle, switches tabs to watch Netflix for 2 hours, then goes back and clicks on something in Moodle again - does that count as using your site for 2 hours?)