---
title: Data
slug: web-experimentation/api/Vxfn-data
docTags: 
createdAt: 2026-08-05T20:56:13.000Z
---

A function to get the `data` object. The `data` object contains the fields of the objects you have created using the Optimizely UI or REST API. For example, if you create a new experiment using an audience, page and event, then you can expect to find all of those objects in the `data` object that is returned from this function.

:::hint{type="info"}
**Note**
`optimizely.get("data")` is a performance-intensive operation. As such, you should use it sparingly. For example, if you need to get multiple pieces of data in the same function, call it once and reuse that reference.
:::

```javascript
var data = optimizely.get('data');
var experiment = data.experiments[myExperimentId];
var firstAudience = data.audiences[experiment.audienceIds[0]];
```

### Syntax

```javascript
data = window["optimizely"].get("data");
```

### Parameters

| Parameter         | Child Attribute | Description                                                |
| ----------------- | --------------- | ---------------------------------------------------------- |
| **data** *string* | N/A             | The argument indicating to get data information. Required. |

### Return value

| Parameter and type                                                    | Child attribute                                      | Description                                                                                                                                                                                                                                                                                                                                                            |
| --------------------------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| *StaticData*                                                          | N/A                                                  | The object contains the fields of the objects you have created using the Optimizely UI or REST API.                                                                                                                                                                                                                                                                    |
| **audiences** *object\[Audience]*                                     | Child attribute of type `StaticData`.                | An object mapping an audience ID to an audience.                                                                                                                                                                                                                                                                                                                       |
| **conditions** *array*                                                | Child attribute of type `Audience`.                  | Conditions the visitor must have to be in the audience.                                                                                                                                                                                                                                                                                                                |
| **id** *string*                                                       | Child attribute of type `Audience`.                  | The ID of the audience.                                                                                                                                                                                                                                                                                                                                                |
| **name** *string*                                                     | Child attribute of type `Audience`.                  | The audience name.                                                                                                                                                                                                                                                                                                                                                     |
| **events** *object\[Event]*                                           | Child attribute of type `StaticData`.                | An object mapping an event ID to an event. Events determine how or what user behavior is tracked.                                                                                                                                                                                                                                                                      |
| **apiName** *string*                                                  | Child attribute of type `Event`.                     | A machine-readable name for the event. The `apiName` value can be used in the event function to indicate which event has occurred.                                                                                                                                                                                                                                     |
| **eventType** *string*                                                | Child attribute of type `Event`.                     | The `eventType` of the event can be either `click` or `custom` to indicate that this event is a Click event or a Custom event. Click events are tied to a specific page and are automatically triggered when a click occurs on the element indicated by the `eventFilter.selector` value. Custom events need to be manually triggered by executing the event function. |
| **eventFilter** *EventFilter* or *undefined*                          | Child attribute of type `Event`.                     | A filter that indicates when an event can automatically be triggered. This is currently only set for events with the `eventType` of `click`. The filter value is `undefined` for events with the `eventType` value set to `custom`.                                                                                                                                    |
| **filterType** *string*                                               | Child attribute of type `EventFilter`.               | The type of filter for an event. Currently the only valid value is `target_selector`.                                                                                                                                                                                                                                                                                  |
| **selector** *string*                                                 | Child attribute of type `EventFilter`.               | A CSS style selector that indicates which element on the page is being tracked.                                                                                                                                                                                                                                                                                        |
| **id** *string*                                                       | Child attribute of type `Event`.                     | The event ID.                                                                                                                                                                                                                                                                                                                                                          |
| **category** *string*                                                 | Child attribute of type `Event`.                     | An event category that was selected upon creation of the event. Some valid values for category are "added to cart", "saved", "shared", "searched", "purchased", "converted", "signed up", "subscribed", and "other".                                                                                                                                                   |
| **name** *string*                                                     | Child attribute of type `Event`.                     | A user-chosen name for an event.                                                                                                                                                                                                                                                                                                                                       |
| **pageId** *integer* or *undefined*                                   | Child attribute of type `Event`.                     | A page ID that indicates the page object this event is related to. This event is only executed on the URLs set in the page object. The `pageId` field is always undefined for events with the `eventType` set to `custom`.                                                                                                                                             |
| **campaigns** *object\[Campaign]*                                     | Child attribute of type `StaticData`.                | An object mapping a campaign ID to a campaign. Campaigns are generated in projects and help tie audiences to experiences.                                                                                                                                                                                                                                              |
| **changes** *array\[Change]*                                          | Child attribute of type `Campaign`.                  | Changes on a campaign level. These changes are executed every time the campaign gets activated, regardless of the experiment and variation a visitor is assigned to.                                                                                                                                                                                                   |
| `*` `*`                                                               | Child attribute of type `Change`.                    | This object can contain project- or environment-specific properties that are not predefined.                                                                                                                                                                                                                                                                           |
| **commitId** *string*                                                 | Child attribute of type `Campaign`.                  | A new "commit" is made every time a campaign is published. The commit ID refers to the commit that was made. Every time a campaign is published, the commit ID changes.                                                                                                                                                                                                |
| **experiments** *array\[Experiment]*                                  | Child attribute of type `Campaign`.                  | An array of experiments within the campaign. For AB tests, there is always one experiment. Personalization campaigns can have more experiments.                                                                                                                                                                                                                        |
| **audienceIds** *array\[string,array]*                                | Child attribute of type `Experiment`.                | Representation of audience conditions for the experiment, including audience IDs and combinators. See `audience_conditions` for format.                                                                                                                                                                                                                                |
| **audienceName** *string*                                             | Child attribute of type `Experiment`.                | Representation of the name of audiences used in the experiment.                                                                                                                                                                                                                                                                                                        |
| **id** *string*                                                       | Child attribute of type `Experiment`.                | The ID of the experiment.                                                                                                                                                                                                                                                                                                                                              |
| **name** *string*                                                     | Child attribute of type `Experiment`.                | The name of the experiment.                                                                                                                                                                                                                                                                                                                                            |
| **integrationSettings** *IntegrationObject*                           | Child attribute of type `Experiment`.                | An object that contains all the integration settings enabled for this experiment. Each key in the object is mapped to a particular integration.                                                                                                                                                                                                                        |
| `*` `*`                                                               | Child attribute of type `IntegrationObject`.         | This object can contain project- or environment-specific properties that are not predefined.                                                                                                                                                                                                                                                                           |
| **variations** *array\[Variation]*                                    | Child attribute of type `Experiment`.                | The variations within an experiment. There are one or more variations in an experiment.                                                                                                                                                                                                                                                                                |
| **actions** *Action*                                                  | Child attribute of type `Variation`.                 | The actions that are executed once a visitor gets bucketed in this variation. The actions describe the variation.                                                                                                                                                                                                                                                      |
| **pageId** *string*                                                   | Child attribute of type `Action`.                    | The ID of the page where the action takes place.                                                                                                                                                                                                                                                                                                                       |
| **changes** *array\[Change]*                                          | Child attribute of type `Action`.                    | An array of changes that have been configured for this page.                                                                                                                                                                                                                                                                                                           |
| `*` `*`                                                               | Child attribute of type `Change`.                    | This object can contain project- or environment-specific properties that are not predefined.                                                                                                                                                                                                                                                                           |
| **id** *string*                                                       | Child attribute of type `Variation`.                 | The ID of the variation.                                                                                                                                                                                                                                                                                                                                               |
| **name** *string*                                                     | Child attribute of type `Variation`.                 | The name of the variation.                                                                                                                                                                                                                                                                                                                                             |
| **weightDistributions** *null* or *array\[WeightDistributionsObject]* | Child attribute of type `StaticData`.                | Traffic allocation among the variations in the experiment.                                                                                                                                                                                                                                                                                                             |
| **entityId** *string*                                                 | Child attribute of type `WeightDistributionsObject`. | The ID of the variation that has the `endOfRange` value assigned to it.                                                                                                                                                                                                                                                                                                |
| **endOfRange** *integer*                                              | Child attribute of type `WeightDistributionsObject`. | Each object in the array has an `endOfRange` value. The `endOfRange` of the current object minus the previous object's `endOfRange` is the traffic allocation assigned to the variation. The last object in the array always has an `endOfRange` value of 10000.                                                                                                       |
| **id** *string*                                                       | Child attribute of type `Campaign`.                  | The ID of the campaign.                                                                                                                                                                                                                                                                                                                                                |
| **name** *string*                                                     | Child attribute of type `Campaign`.                  | The name of the campaign.                                                                                                                                                                                                                                                                                                                                              |
| **holdback** *integer*                                                | Child attribute of type `Campaign`.                  | The holdback value on a campaign represents the percentage of visitors excluded from a campaign. If the holdback is set to 500, then 5% of all visitors are excluded from the campaign.                                                                                                                                                                                |
| **policy** *string*                                                   | Child attribute of type `Campaign`.                  | The policy of a campaign indicates whether the campaign is an A/B test or a Personalization campaign. Possible values: `single_experiment` (A/B test), `random` (Personalization campaign).                                                                                                                                                                            |
| **integrationSettings** *IntegrationObject*                           | Child attribute of type `Campaign`.                  | An object that contains all the integration settings enabled for this campaign.                                                                                                                                                                                                                                                                                        |
| `*` `*`                                                               | Child attribute of type `IntegrationObject`.         | This object can contain project- or environment-specific properties that are not predefined.                                                                                                                                                                                                                                                                           |
| **pageIds** *array\[string]*                                          | Child attribute of type `Campaign`.                  | An array with the IDs of all the pages that are used within the campaign.                                                                                                                                                                                                                                                                                              |
| **pages** *object\[Page]*                                             | Child attribute of type `StaticData`.                | An object mapping a page ID to a page. Pages are used to determine where experiments execute and to track user behavior.                                                                                                                                                                                                                                               |
| **apiName** *string*                                                  | Child attribute of type `Page`.                      | A machine-readable name for the page. The `apiName` value can be used in the page function to indicate which event has occurred.                                                                                                                                                                                                                                       |
| **id** *string*                                                       | Child attribute of type `Page`.                      | The page ID.                                                                                                                                                                                                                                                                                                                                                           |
| **category** *string*                                                 | Child attribute of type `Page`.                      | An event category that was selected upon creation of the page.                                                                                                                                                                                                                                                                                                         |
| **staticConditions** *array*                                          | Child attribute of type `Page`.                      | A user-chosen name for a page.                                                                                                                                                                                                                                                                                                                                         |
| **tags** *array\[VisualTagObject]*                                    | Child attribute of type `Page`.                      | An array of the visual tags saved on a page.                                                                                                                                                                                                                                                                                                                           |
| **category** *string*                                                 | Child attribute of type `VisualTagObject`.           | A tag category that was selected upon creation of the tag.                                                                                                                                                                                                                                                                                                             |
| **locator** *string*                                                  | Child attribute of type `VisualTagObject`.           | The logic or CSS selector indicating where a tag is located on the page.                                                                                                                                                                                                                                                                                               |
| **apiName** *string*                                                  | Child attribute of type `VisualTagObject`.           | A machine-readable name for the tag.                                                                                                                                                                                                                                                                                                                                   |
| **locatorType** *string*                                              | Child attribute of type `VisualTagObject`.           | An enum that indicates if the locator is custom `"javascript"` or a `"css_selector"`.                                                                                                                                                                                                                                                                                  |
| **experiments** *object\[Experiment]*                                 | Child attribute of type `StaticData`.                | An object mapping an experiment ID to an experiment. Every campaign has one or more experiments.                                                                                                                                                                                                                                                                       |
| **variations** *object\[Variation]*                                   | Child attribute of type `StaticData`.                | An object mapping a variation ID to a variation. The variations are used in experiments and experiences.                                                                                                                                                                                                                                                               |
| **projectId** *string*                                                | Child attribute of type `StaticData`.                | The ID of your Web Experimentation project that is installed on this page.                                                                                                                                                                                                                                                                                             |
| **accountId** *string*                                                | Child attribute of type `StaticData`.                | The ID of your Web Experimentation account.                                                                                                                                                                                                                                                                                                                            |
| **dcpServiceId** *string* or *null*                                   | Child attribute of type `StaticData`.                | The ID of a DCP service associated with the project installed on this page.                                                                                                                                                                                                                                                                                            |
| **revision** *string*                                                 | Child attribute of type `StaticData`.                | The revision of your snippet. The revision is incremented every time the snippet is updated.                                                                                                                                                                                                                                                                           |

### Example call

```javascript
data = window["optimizely"].get("data");
```

### Example return value

```javascript
{
  "audiences": {
    "4728608810": {
      "conditions": ["and", ["or", ["or", {
        "value": "search",
        "type": "source_type",
        "name": null,
        "match": null
      }, {
        "value": "campaign",
        "type": "source_type",
        "name": null,
        "match": null
      }]]],
      "id": "6618392098",
      "name": "Search traffic"
    }
  },
  "events": {
    "4958230289": {
      "category": "other",
      "name": null,
      "eventType": "click",
      "apiName": "blog_clicks_hero_nav",
      "id": "4958230289",
      "eventFilter": {
        "filterType": ".hero-container",
        "selector": "target_selector"
      },
      "pageId": "4761512980"
    }
  },
  "campaign": {
    "6676370413": {
      "holdback": 500,
      "activation": {},
      "integrationSettings": {},
      "viewIds": ["6678290257"],
      "experiments": [{
        "weightDistributions": null,
        "audienceName": "Chrome users",
        "name": null,
        "bucketingStrategy": null,
        "variations": [{
          "id": "6626731852",
          "actions": [],
          "name": "Variation #1"
        }],
        "audienceIds": ["6672770135"],
        "changes": null,
        "id": "6666781105",
        "integrationSettings": null
      }],
      "id": "6676370413",
      "weightDistributions": null,
      "name": "Example personalization campaign",
      "commitId": "6667420425",
      "decisionMetadata": null,
      "policy": "ordered",
      "changes": null,
      "pageIds": ["6678290257"]
    }
  },
  "pages": {
    "6678290257": {
      "category": "other",
      "staticConditions": ["and", ["or", {
        "type": "url",
        "value": "https://developers.optimizely.com/",
        "match": "simple"
      }]],
      "name": "Homepage",
      "tags": [{
        "category": "other",
        "locator": ".push-quad > a:nth-of-type(1)",
        "valueType": "string",
        "locatorType": "css_selector",
        "apiName": "view_docs_button"
      }],
      "apiName": "homepage",
      "id": "6678290257"
    }
  },
  "experiments": {
    "6661191859": {
      "weightDistributions": [{
        "entityId": "6665951608",
        "endOfRange": 5000
      }, {
        "entityId": "6670551924",
        "endOfRange": 10000
      }],
      "audienceName": "Everyone else",
      "name": null,
      "bucketingStrategy": null,
      "variations": [{
        "id": "6665951608",
        "actions": [],
        "name": "Original"
      }, {
        "id": "6670551924",
        "actions": [{
          "viewId": "6678290257",
          "changes": [{
            "selector": ".flex-justified--center > div:nth-of-type(1) .push-double--top",
            "dependencies": [],
            "attributes": {
              "html": "Web "
            },
            "type": "attribute",
            "id": "4810EE32-D209-4EBD-A8DC-6CE245DA8B6B",
            "css": {}
          }],
          "pageId": "6678290257"
        }],
        "name": "Variation #1"
      }],
      "audienceIds": null,
      "changes": null,
      "id": "6661191859",
      "integrationSettings": null
    }
  },
  "variations": {
    "7600254716": {
      "id": "7600254716",
      "actions": [{
        "viewId": "7585662249",
        "changes": [{
          "selector": "h1",
          "dependencies": [],
          "attributes": {
            "html": "Develop with Optimizely! "
          },
          "type": "attribute",
          "id": "EE809A94-4044-4DD0-B387-D05D478ED702",
          "css": {}
        }],
        "pageId": "7585662249"
      }],
      "name": "Variation #1"
    }
  },
  "projectId": "6663270427",
  "accountId": "200607994",
  "revision": "2433",
  "dcpServiceId": "3383760141"
}
```
