Skip to content

Basic Recipes

Patrick@FullStory edited this page Jan 29, 2019 · 34 revisions

Keep two things in mind when analyzing your Data Export data:

  1. Rows are individual events created during sessions
  2. Distinct sessions can be found by grouping on a compound key of sessionid + userid

All SQL examples are written in Postgres SQL.

Total session count

select count(*) as "total recorded session count for your org"
from 
(select sessionid, userid
from fsexport 
group by sessionid, userid)

image

Most active sessions

You can find session activity (the number of events generated per session) by counting the aggregated rows once they are grouped by sessionid and userid.

This example also demonstrates how you can construct FullStory session replay URLs. You can find your org id by going to the JavaScript snippet on the settings page in the FullStory application: window['_fs_org'] = 'your org id';

select count(sessionid) as "events per session",
'https://app.fullstory.com/ui/'||'your org id'||'/session/'||userid||':'||sessionid as "session replay URL"
from fsexport 
group by sessionid, userid
having "events per session" > 35
order by "events per session" desc

image

Sessions by length

You can compute session length by finding the difference between the Min and Max eventstart values.

select trunc(extract(second from (Max(eventstart) - Min(eventstart)))/60, 2) as "session length (minutes)",
count(sessionid) as "events per session",
'https://app.fullstory.com/ui/'||'your org id'||'/session/'||userid||':'||sessionid as "session replay URL"
from fsexport 
group by sessionid, userid
order by "session length (minutes)" desc

image

Sessions per user

Grouping on userid and counting distinct sessionid will provide the number of sessions for each user. you can use this to discover your most active users.

select userid as "user id", 
useremail as "email", 
count(distinct sessionid) as "sessions per user"
from fsexport 
group by userid, useremail
order by "sessions per user" desc

Sessions per page

You can discover the top pages visited by your users by grouping on pageurl and then calculating the average sessions per user for each page.

select pageurl, 
count(distinct userid) as "unique users", 
count(sessionid) as "total sessions",
"total sessions"/"unique users" as "avg sessions per user"
from fsexport 
group by pageurl
order by "avg sessions per user" desc

image

Clone this wiki locally