How to detect session duration time?

How to detect session duration time?

One client would like to have a "mean session duration" counter in their application... since we have an OnSessionStart system action, but no OnSessionEnd... how can we do this? How to detect session termination using the platform?

One simple idea to do this is to use the Outsystems Hub Server screen logging tables. These are the oslog_screen_X (where X ranges from 0 to 9) tables.

Each time a screen request is made to the Outsystems platform, a log entry is created on the oslog_screen_X table with the corresponding screen identification, session_id and timestamp.

What you must do to get an idea of the mean session duration is simply to query the database in order to get the average time between the last and first screen log for each session_id (a GROUP BY session_id clause will do the job).

As the log table is really pure "raw data" you can make your query as complex as you like, meaning that you can filter the results for sessions that start on a specified screen, etc.

Hope this helps,


Daniel Lourenço
Hi Paulo.

The eSpace usage reports inside the Analytics tab of ServiceCenter has an average Session Duration column.
Thanks for the replies.

I need to differentiate between various user profiles - in order to get mean session durations for Administrators, Authorized users, etc.

The oslog_screen_X tables solution is good, but it has some difficulties:

- Due to log rotation, it would have to be done on an extension, in batch, working on the last log table (in order to get complete results);

- It doesn't get me information about the profiles - although I could save each session_id and it's related profile type on a table to match that information later - it seems a bit to much overhead, though.

The eSpace usage report also does not provide me info about the profiles.

Any ideas?...
Just copy the createactivity reports logic to your espace and add the corresponding profile fields to your reports.