Skip to main content

Sessions

A session groups everything one viewer does in one sitting. This page covers when a session ends, how to hold one open through video playback, and how to start a new one deliberately.

When a session ends​

A session starts at coralogix_roku_initialize() and ends after either of these:

Ends afterWhat extends it
2 hours of inactivity. Change this setting to 15-240 minutes with sessionConfig.inactivityTimeoutMinutesA key press on the remote, or reportUserActivity
4 hours in totalCan't be extended.

The next record after a session ends starts a new session instead of being dropped. The new session links to the one before it through prev_session. Each new session is sampled again, so with a sessionSampleRate below 100 it may not be recorded. An inactivityTimeoutMinutes of 240 matches the 4-hour limit, so in practice only that limit ends a session.

Keep the session alive during playback​

Video playback produces no key presses, so a long video watched without pressing any key ends the current session part-way through, after 2 hours. To keep one session for the whole video, call reportUserActivity while content plays, for example from your Video node's position observer:

sub onPositionChange()
m.global.cxRum.callfunc("reportUserActivity")
end sub

The call refreshes the idle timer only, so calling it on every position update is fine. It does not extend the four-hour total limit. When the session has already ended, the call starts a new one and returns the new session ID.

To read the current session ID without affecting the session, use getSessionId instead.

Start a new session​

To end the current session and start a new one, for example when the viewer signs out or switches profile, call createNewSession:

newSessionId = m.global.cxRum.callfunc("createNewSession")

Records sent after this call belong to the new session.

Last updated on