Getting started with Optimizely's JS API
1. Log in to your Optimizely account
Log in at https://app.optimizely.com/signin.
2. Implement the Optimizely Snippet
If you are not already running Optimizely, you'll need to add the Optimizely Snippet to the head section of your web page. See Implementing the Optimizely Snippet for detailed instructions on how to add the Optimizely Snippet for your project.
3. Start an experiment
4. Read from the Data Object
The Optimizely Data Object is a read-only data object that contains information about the current visitor. You can use the Data Object to retrieve the state of and details about Optimizely experiments, variations, and goals for that visitor. For example, you can read which experiments and variations a visitor has seen and pass this information to your internal database.
To access the Data Object, open your browser console and type
For example, you can see what experiments are active for the current visitor in the object below:
5. Make an API call
In addition to reading from the Data Object, you can also make API calls to write data and modify the behavior of Optimizely. The API function calls expose many of Optimizely's decisions and actions so you can take control.