Get Session Details
Retrieve the session ID or a link to replay of the current session. The link can point to the beginning of the session or to the current moment time.
Parameters
Possible values: url
, id
, url.now
Enumerated value that defines what kind of ID should be returned:
url
- (default value) the returned URL links to the beginning of the session replay
id
- the session ID is returned
url.now
- the returned URL links to the moment in the replay when the method is invoked
Special Consideration
A session url or ID can only be returned by FS('getSession')
if capture has begun. Before this FS('getSession')
returns null
or undefined
. To be assured of getting a session url, you can use FS('observe')
or the asynchronous version: FS('getSessionAsync')
. More details about the Fullstory client-side bootstrapping process can be found on our
knowledge base.
FS('getSession', { format: 'url' })
Example Invocation
Get a link to the beginning of the session replay using FS('observe')
FS('observe', {
type: 'start',
callback: () => {
const sessionUrlFromBeginning = FS('getSession');
}
});
Get a link to a specific session replay moment in time asynchronously
const sessionUrlAtTime = await FS('getSessionAsync', { format: 'url.now' });
Get the current session ID using the legacy _fs_ready
callback
window['_fs_ready'] = function() {
const sessionId = FS('getSession', { format: 'id' });
};