The Full Stack Developer Guide Developer Hub

Welcome to the Full Stack Developer Guide developer hub. You'll find comprehensive guides and documentation to help you start working with the Full Stack Developer Guide as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

Properties

In Optimizely X all of the properties are accessible through functions. From a performance point of view, this is a huge improvement, but it does change the structure of how data is accessible. Below is an overview of how to access data that you had access to in Classic with the Optimizely X JavaScript API.

If the Optimizely snippet is in a bundled state, you can access all your Classic data through the Classic JS API and Optimizely X data through the Optimizely X JS API.

State

Available in Optimizely X: Yes, but in a different format.

Classic format:

window["optimizely"].data.state

Optimizely X format:

window["optimizely"].get("state")

The state object contains information about the current state of Optimizely on the page. In Optimizely Classic the state object contained properties containing information about which experiments were active, which variations a visitor was seeing at the moment, and whether a redirect experiment had executed on the previous page. All that information is accessible in Optimizely X with the window["optimizely"].get("state") function. In Optimizely Classic the state object contained function instead of properties. With the functions that are returned, you can specify filters. All the same information is available through those methods.

Read more about the available methods here.

Visitor

Available in Optimizely X: Yes, but in a different format.

Classic format:

window["optimizely"].data.visitor

Optimizely X format:

window["optimizely"].get("visitor")

The visitor object contains information about what Optimizely knows about the current visitor. In Optimizely X that same information (and more) is accessible through the window["optimizely"].get("visitor") function.

Read more about the visitor object here.

Data

Available in Optimizely X: Yes, but in a different format.

Classic format:

window["optimizely"].data

Optimizely X format:

window["optimizely"].get("data")

The data object in Optimizely Classic contained all the information that you could read. In Optimizely Classic state data and visitor information were nested in the data object. In Optimizely X they're separated out into new functions (see above). All the static data that used to be in window["optimizely"].data is accessible with window["optimizely"].get("data"). The object that's returned contains information about all the campaigns, experiments, audiences, pages, and events that are published in your Optimizely project.

Read all about the new data object here.

Revision

Available in Optimizely X: Yes, but in a different format.

Classic format:

window["optimizely"].revision

Optimizely X format:

window["optimizely"].get("data").revision

The revision number is accessible through window["optimizely"].get("data").revision.

Get account ID

Available in Optimizely X: Yes, but in a different format.

Classic format:

window["optimizely"].getAccountId()

Optimizely X format:

window["optimizely"].get("data").accountId

In Optimizely X the account ID is stored in the data Object. You can access the account ID with window["optimizely"].get("data").accountId.

Get project ID

Available in Optimizely X: Yes, but in a different format.

Classic format:

window["optimizely"].getProjectId()

Optimizely X format:

window["optimizely"].get("data").projectId

In Optimizely X the project ID is stored in the data Object. You can access the project ID with window["optimizely"].get("data").projectId.

Updated about a year ago



Properties


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.