This article will help you:
  • Use the browser console (debugger) to access the Optimizely data object and log
  • QA and debug experiments using the data object and log
  • Retrieve and use information about visitors, contained in the data object, for targeting, goal tracking, or reporting
  • Check goal firing with the network console

Optimizely has a few powerful features for exposing and using experiment information: the data object, the log, and the network console. You'll find these useful for debugging and QAing experiments, as well as customizing your experiments, similar to how you might use the JavaScript API.

Access the browser console

To use the data object and the Optimizely log directly from the browser, you'll want to access the browser console and enter a string of text. We'll show you how to access the console in Google Chrome and Mozilla Firefox in this section.


To access the browser console, use the following steps using the Google Chrome browser. You can use other browsers such as Firefox as well.

  1. Open a new incognito or private browsing window.
  2. Set your test cookie or go to your staging environment if you're QAing a certain experiment.
  3. Then open the console using one of three ways: 
  • Open the Chrome menu at the top-right of your browser window, then select Tools > More Tools > Developer Tools. Click the Console tab.
  • Right-click any page element and select Inspect Element. Click the Console tab.
  • Using a keyboard shortcut, open Developer Tools and bring focus to the console.
    • Windows: Ctrl + Shift + J
    • Mac: Cmd + Opt +J


Now that you have the console open, you can access the data object, Optimizely log, and network console. Jump to the next section to learn more.


To access the browser console with the Mozilla Firefox browser, use the following steps.

  1. Open a new incognito or private browsing window.
  2. Set your test cookie or go to your staging environment if you're QAing a certain experiment.
  3. Install the Firebug add-on for a user-friendly version of the developer console.
  4. Right-click an element on the page and select Inspect Element with Firebug. Or, from the browser toolbar, you can select Tools > Web Developer > Firebug > Open Firebug.

Once you have the console open, you can access the data object, Optimizely log, and network console much as you would in Google Chrome. Jump down to each section to learn more.

Select the Console tab to probe the data object for optimizely.activeExperiments, optimizely.variationNamesMap, and more. 

To check your goals in the network panel, select the Net tab and click Persist and XHR. Type "optimizely" in the field to filter your results. Click to select an Optimizely log URL. Then, click to open the drop-down menu and select the Params tab to see the query string parameters.


If you don't see anything in the console, try refreshing the page after you click Persist.

Select the Cookies tab to see Optimizely's cookies.


There are alternate ways to access both the data object and the log, depending on your need:

  • Alternate method for the data object: Call the data object directly from your code by referencing window[“optimizely”] in your JavaScript, for instance if you want to use information from the data object in your code.
  • Alternate method for the log: Add this query parameter to the end of your page's URL in your browser, then refresh the page:

The Optimizely Data Object

The Optimizely data object is a window-level object -- in other words, a JavaScript object whose scope is set to the window, meaning it is accessible by external functions and JavaScript.

The data object is accessible by any JavaScript that runs on your page after the Optimizely Snippet. It provides you with information and tools that you can use for both development and debugging.

What’s in the Optimizely data object? 

  • Information about the visitor – location, device, audiences, and segments that they match
  • Information about experiments and variations a visitor has seen
  • Information about all components of the Snippet
  • Special functions to help with determining the status of the user

The data object can help you in a variety of ways. Here are just a few:

  • QAing and debugging experiments
  • Create targeted messaging by getting information about a visitor’s location or audiences they are a part of
  • Special audience targeting (for example, mutually exclusive tests) by seeing all experiments a visitor has been bucketed into
  • Sending data to a phone service or other off-line location to track conversions
  • Tell other analytics platforms information about the user and what they’ve seen in Optimizely.

The Optimizely data object can be referenced from most locations where code can be inserted within Optimizely - variation code, Experiment JavaScript, Custom JavaScript Audience conditions, or Conditional Activation. The only location where it cannot be used is in Project JavaScript. This is because Project JavaScript executes before the data object is fully formed.


When you QA an experiment, you should use the data object to determine whether your URL Targeting and Audiences are set up correctly. Here's how:

  1. Go to the page(s) you want to test.
  2. Type the following in the browser console:
  • optimizely.activeExperiments - this will return a list of all experiments currently running on the page for that visitor. Do you see the experiment you expect to be running? If so, you have passed the targeting conditions.

  • optimizely.variationNamesMap - this will return a mapping of experiment IDs to variation names for all experiments into which the visitor is currently cookied, both active and inactive on the page. This allows you to see which variations you're bucketed into.

    When you do this, the window-level data object provides read-only information about the current user and active experiments on the page.

Useful data object contents

Below are some of the most useful portions of the Optimizely data object. For a more complete list, visit our JavaScript API.


A list of the experiments and variations that a user has been bucketed in to, listed by variation ID.

optimizely.variationMap A list of the experiments and variations that a user has been bucketed in to, listed by variation index.

Force the user into a specific experiment and variation. 

  • bucketVisitor(experimentID, variationID)
  • optimizely.bucketVisitor(experimentID, variationNum)
optimizely.revision The current revision of the Optimizely Snippet.
optimizely.push(“log”) Push log statements that Optimizely keeps track of during execution (see below).
optimizely.getAccountId() Get the account ID.
optimizely.getProjectId() Get the project ID.

Get information about the visitor:

  • Location
  • IP Address
  • Audiences, dimensions, segments
  • Device and Platform

An object with all of the query parameters and values in the current URL. Get information about third-party integrations.

Get information about all experiments in the Snippet:

  • Experiment Variation IDs
  • Audiences
  • Experiment CSS and JS

The Optimizely Log

If you run into issues during your QA process, but can't easily diagnose them, the Optimizely Log is a valuable resource. Think of the log as a way of "reading Optimizely's mind" and understanding every process and decision that Optimizely made during execution.

Essentially, the log is a data dump of all actions and decisions that Optimizely took to bucket visitors into audiences or dimensions, how goals are tracking, and which experiments are running (or not running). This information will let you get to the root cause of most issues that you run into during your Pre-Launch Checklist.

Run the log in the console by typing:

window['optimizely'] = window['optimizely'] || [];

In the console, you should see many lines get printed to the console. If you scroll up you should see the following line signifying the start of the Optimizely log:

Optimizely / Main / Started, revision #### [time 0 +0]

Reading the Log:

The log file is broken up into 4 areas:

"Optimizely" Lets you know the log is from our snippet and can be used to filter only Optimizely logs
Category (see below) The category of code being executed
Action Describes what action was taken and provides relevant information
Timestamp (see below) Shows when the action ran and how long it took

The first number represents how many milliseconds (ms) passed between when the snippet loaded and when the action was performed. The second number represents how many milliseconds (ms) the action took to perform.

The log will report on many categories of code. In the above example, the category is "Condition," but possible values can be:

Main Signifies the start of the Optimizely log and the execution of the Snippet.
Segmenter Looks at the optimizelySegments cookie and gets the IDs of the segments you are in.
Visitor Shows what Audiences and Dimensions the visitor has been bucketed into.
Condition Shows which conditions the visitor passes or fails (like URL Targeting, Audience Conditions, and Activation Type).
Integrator Shows information about Optimizely integrations, such as analytics or heatmapping platforms.
Info Gives you information about different data points, such as whether the Snippet is enabled, whether force variation has been enabled, whether a visitor is new or returning, the user ID, the browser type, and more.
Distributor Tells you that logic ran to determine whether the visitor should be bucketed to a variation and which variation based on traffic allocation.
Tracker Shows any requests for logs, events, cookie removals, and changes.
  • Used to run code, bind goals to CSS selectors, total number of times it ran until it found a selector in the DOM. 
  • Shows how many attempts Optimizely makes to evaluate variation code, bind goals to CSS selectors, and find selectors in the DOM.
  • Once code has executed, Evaluator shows what code the experiment is executing and when.
API Denotes any API functions called.

The network panel

Network traffic is a log within your browser of all events that occur as you interact with a page. When you trigger a goal in Optimizely, it fires a tracking call, which will be picked up in the network traffic.

Read on to learn about checking how goals fire in your network panel.


Click any image to view it at full size.

1. Navigate to the network panel in your developer tools.

2. Click XHR and type "optimizely" to filter your results.

3. In the browser, fire the goal you'd like to test. With a click goal, this can be accomplished by right clicking on the element on your page. If the element is tracking properly, a network event will appear in your list of paths. Click on the event and stay under the Headers tab.

4. Confirm that your goal has fired

Under “Query String Parameters,” you'll find a list of event details.

  • “x” lists any experiment you are bucketed in, mapped to the variation ID
  • “s” lists the segments you are in, by segment ID
  • “n” tells you the name of the event. If the event is a pageview, the URL of the page will be shown instead

If the event is a revenue goal, the n parameter will contain orderID, and there will be an additional "v" parameter with the revenue value represented in cents.

Troubleshooting Tip: What if you try to fire your goal, but it doesn’t appear in the Network panel? Unfortunately, that means it is not firing. There are a couple common reasons why this may be happening:

  • You’ve chosen the wrong selector for your goal
  • Your goal targeting is incorrect

Check out our troubleshooting article on goals to get tips on how to avoid incorrectly setting up your goals.