Session Details Page
Today we added a new session details page to WebTuna. This allows you to drill down into the page views and AJAX calls for a particular user’s session and see timings for each request. This also includes user “think time” between the pages and “Time to request start” which includes redirection time, DNS lookup time, SSL setup time and TCP connection setup time.
Definition of a Session
A session is a group of interactions that take place on your website within a given time frame. For example a single session can contain multiple page views and AJAX requests. A single user can open multiple sessions if they use more than one browser. A single user might also have multiple sessions in a day should one session end and new one begin. By default a session ends after 30 minutes of inactivity.
For example:
- When a user, Tom, arrives on your site, WebTuna starts counting from that moment. If 30 minutes pass without any requests from Tom then the session ends. However, every time Tom makes a new request for a page or AJAX request then WebTuna resets the expiration time by adding on an additional 30 minutes from the time of that interaction.
Upgrade to webtuna.js 3.3
NOTE: We made changes to webtuna.js that affect when sessions are started and terminated. In order to benefit from this new feature customers should download the webtuna.js from https://cdn.webtuna.com/webtuna.js and replace their existing one with this version.
Overriding default Session behaviour
There are 2 ways in which you can override the default behaviour described above.
- Override wt.sessionTimeout and set a different session timeout duration.
- Override wt.session and use the session id used within your application.
NOTE: There is no point in overriding both of these. If you do, only wt.session will be used and wt.sessionTimeout will be ignored.
To override wt.sessionTimeout, create a JavaScript function with that name and return the new timeout value in milliseconds.
Example setting session timeout to 60 mins (=3600000ms)
Add this code below the line where webtuna.js is loaded.
1
2
3
4
5
<script type="text/javascript">
wt.sessionTimeout = function (){
return 3600000;
};
</script>
To override the wt.session create a JavaScript function with that name and return a string that represents the application’s session id. This is normally stored in a session cookie in the browser, which can be retrieved by document.cookie.match and then parsed.
JSESSIONID example for Java applications
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<script type="text/javascript">
wt.session = function (){
var jsId = document.cookie.match(/JSESSIONID=[^;]+/);
if(jsId != null) {
if (jsId instanceof Array)
jsId = jsId[0].substring(11);
else
jsId = jsId.substring(11);
} else {
jsId = '';
}
return jsId;
};
</script>
Add this code below the line where webtuna.js is loaded.
PHPSESSID example for PHP applications
Add this code below the line where webtuna.js is loaded
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<script type="text/javascript">
wt.session = function (){
var phpSessionId = document.cookie.match(/PHPSESSID=[A-Za-z0-9]+;/i);
if(phpSessionId == null)
return '';
if(typeof(phpSessionId) == 'undefined')
return '';
if(phpSessionId.length <= 0)
return '';
phpSessionId = phpSessionId[0];
var end = phpSessionId.lastIndexOf(';');
if(end == -1) end = phpSessionId.length;
return phpSessionId.substring(10, end);
}
</script>