Disclaimer: This website requires Please enable JavaScript in your browser settings for the best experience.

The availability of features may depend on your plan type. Contact your Customer Success Manager if you have any questions.

Dev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideLegal TermsGitHubDev CommunityOptimizely AcademySubmit a ticketLog In
API Reference

Session

Get metadata for the current session. - Deprecated.

🚧

Deprecation warning

This API is deprecated and was removed in March 2018. You can use the session_index field if you are looking to query for events from a particular session.

Syntax

session = window["optimizely"].get("session");

Parameters

Parameter and TypeChild AttributeDescription
session
string
N/AThe argument indicating to get session information. Required.

Return value

Parameter and TypeChild AttributeDescription
SessionObjectN/AThe object containing session information.
lastSessionTimestamp
integer
Child attribute of type SessionObjectA timestamp of when the last session was started.
sessionId
string
Child attribute of type SessionObjectA unique ID for this session. Optimizely Web Experimentation will use this unique ID to calculate results.
*
*
Child attribute of type SessionObjectThis object can contain project- or environment-specific properties that are not predefined.

Example Call

session = window["optimizely"].get("session");

Example Return Value

{
  "lastSessionTimestamp": 1476765927360,
  "sessionId": "b6d3c104-2057-408e-acfe-8ca554713d8f"
}