> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kameleoon.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Experiment and personalization objects

> Reference for the Experiment, Personalization, activation, Variation, and Template objects.

These objects describe experiments and personalizations and whether each one activated in the current visit.

## Experiment

An Experiment object represents a Kameleoon A/B test. Core properties include the segment and associated variations. Variations contain the JavaScript and CSS code that implements the changes.

**Properties**

| Name | Type | Description |
| - | - | - |
| id | Number | ID of the experiment. |
| name | String | Name of the experiment. |
| dateLaunched | Number | Time of first launch of the experiment (UTC format - ms since January 1, 1970). |
| dateModified | Number | Time of last modification of the experiment (UTC format - ms since January 1, 1970). |
| targetSegment | Object | [Segment object](https://docs.kameleoon.com/developer-docs/apis/activation-api-js/api-reference/objects/goal-segment-trigger-and-product.md#segment) associated with the experiment. |
| variations | Array | List of [Variation objects](#variation) for this experiment. |
| trafficDeviation | Object | Map of current experiment traffic deviation. Keys are variation IDs (ID **0** is the reference). Values are percentages (0-100). The sum may not equal 100 if some traffic isn't allocated. |
| untrackedTrafficReallocationTime | Number | Time of the last reallocation performed for untracked traffic (UTC format - ms since January 1, 1970). If the engine never performed a reallocation, the value is **null**. |
| goals | Array | List of [Goal objects](https://docs.kameleoon.com/developer-docs/apis/activation-api-js/api-reference/objects/goal-segment-trigger-and-product.md#goal) tracked for the experiment. |
| mainGoal | Object | [Goal object](https://docs.kameleoon.com/developer-docs/apis/activation-api-js/api-reference/objects/goal-segment-trigger-and-product.md#goal) representing the main goal of the experiment. |
| triggered | Boolean | Boolean equal to **true** if the experiment triggered on the page, else to **false**. |
| active | Boolean | Boolean equal to **true** if the experiment is active on the page, else to **false**. |
| triggeredInVisit | Boolean | Boolean equal to **true** if the experiment triggered in the current visit, else to **false**. Triggering in a visit means that the visit fulfilled the experiment's segment conditions at some point. |
| activatedInVisit | Boolean | When **true**, the engine activated the experiment during the current visit. A triggered experiment doesn't always result in activation; factors like traffic exclusion or capping can prevent activation. |
| nonExpositionReason | String | If the engine triggered but didn't activate the experiment, this field represents the reason. Possible values: `EXPERIMENT_EXCLUSION` (the visitor belongs to the population excluded from the experiment, that is, they aren't counted towards results) and `VISITOR_CAPPING` (the visitor reached a capping limit that prevents activation). This property is available if the engine triggered the experiment on the current page and `active` is **false**. |
| associatedVariation | Object | [Variation object](#variation) associated with the experiment for the given visitor. If the experiment isn't yet activated, this is usually **null**, except if the engine pre-allocated a variation. |
| redirectProcessed | Boolean | When **true**, a URL redirection occurred for this experiment on the previous page. You set this property through [processRedirect()](https://docs.kameleoon.com/developer-docs/apis/activation-api-js/api-reference/modules/core.md#processredirect) or manual configuration. In JavaScript-based integrations, redirects can cancel further code execution; check this property to resend network requests on the landing page if necessary. |

## Personalization

A Personalization object represents a Kameleoon personalization action for a specific segment. Core properties include the segment and the associated single variation. The Variation object contains the JavaScript and CSS code that implements the personalization action.

**Properties**

| Name | Type | Description |
| - | - | - |
| id | Number | ID of the personalization. |
| name | String | Name of the personalization. |
| dateLaunched | Number | Time of first launch of the personalization (UTC format - ms since January 1, 1970). |
| dateModified | Number | Time of last modification of the personalization (UTC format - ms since January 1, 1970). |
| targetSegment | Object | [Segment object](https://docs.kameleoon.com/developer-docs/apis/activation-api-js/api-reference/objects/goal-segment-trigger-and-product.md#segment) associated with the personalization. |
| goals | Array | List of [Goal objects](https://docs.kameleoon.com/developer-docs/apis/activation-api-js/api-reference/objects/goal-segment-trigger-and-product.md#goal) tracked for the personalization. |
| mainGoal | Object | [Goal object](https://docs.kameleoon.com/developer-docs/apis/activation-api-js/api-reference/objects/goal-segment-trigger-and-product.md#goal) representing the main goal of the personalization. |
| triggered | Boolean | When **true**, the personalization triggered on the page. |
| active | Boolean | When **true**, the personalization is active (displayed) on the page. |
| triggeredInVisit | Boolean | When **true**, the personalization triggered during the current visit. This indicates that the visit fulfilled the personalization's segment conditions. |
| activatedInVisit | Boolean | When **true**, the engine displayed the personalization's action during the current visit. Triggering a personalization doesn't always mean that the engine displays the action; for example, capping options or control group membership can prevent display. |
| nonExpositionReason | String | Reason for non-exposition if triggered but not displayed. Possible values: `GLOBAL_EXCLUSION`, `PERSONALIZATION_EXCLUSION`, `PRIORITY`, `SCHEDULE`, `PERSONALIZATION_CAPPING`, `VISITOR_CAPPING`, `SCENARIO`, and `SIMULATION`. This property is available if the personalization triggered on the current page and `active` is **false**. |
| associatedVariation | Object | Associated [Variation object](#variation). This property always references a valid object for personalizations. |

## ExperimentActivation

An `ExperimentActivation` object represents an experiment activated during a specific visit. Because visits can be historical, the associated experiment might have stopped. In such cases, the engine doesn't inject experiment metadata (name, launch date, segment) into the application file, which makes it unavailable through the API. However, the IDs remain available.

**Properties**

| Name | Type | Description |
| - | - | - |
| experimentID | Number | ID of the experiment. |
| associatedVariationID | Number | ID of the associated variation. If the associated variation is the reference (control), the ID is equal to 0. |
| associatedVariation | Object | Associated [Variation object](#variation). This property is **null** if the experiment or variation is no longer active (stopped or paused). |
| times | Array | List of activation times for this experiment on this visit (UTC format - ms since January 1, 1970). |

## PersonalizationActivation

A `PersonalizationActivation` object represents a personalization activated during a specific visit. As with experiments, metadata is unavailable if the personalization has stopped, although IDs remain accessible.

**Properties**

| Name | Type | Description |
| - | - | - |
| personalizationID | Number | ID of the personalization. |
| associatedVariationID | Number | ID of the associated variation. |
| personalization | Object | Associated [Personalization object](#personalization). This property is **null** if the personalization is no longer active (stopped or paused). |
| associatedVariation | Object | Associated [Variation object](#variation). This property is **null** if the personalization or variation is no longer active (stopped or paused). |
| times | Array | List of activation times for this personalization on this visit (UTC format - ms since January 1, 1970). |

## Variation

A `Variation` object represents a component of an `Experiment`. An A/B test contains multiple variations, such as an A/B test with one variation plus reference or an A/B/C test with two plus reference. Personalizations associate with a single [Variation object](#variation).

> [!NOTE]
>
> During variation code execution, the `this` keyword references the corresponding `Variation` object. Use this reference to navigate the object hierarchy (for example, through the `associatedCampaign` property).

**Properties**

| Name | Type | Description |
| - | - | - |
| id | Number | Unique id of the variation. If the variation represents the reference (control), the ID is equal to **0**. |
| name | String | Name of the variation. If the variation represents the reference (control), the name is equal to `Reference`. |
| associatedCampaign | Object | The [Experiment](#experiment) or [Personalization](#personalization) object linked to this variation. |
| instantiatedTemplate | Object | [Instantiated template object](#template) that produced this variation, if applicable. If the variation didn't come from a template, this property is **null**. |
| reallocationTime | Number | Time of the last traffic reallocation performed for the variation (UTC format - ms since January 1, 1970). If the engine never performed a reallocation for the variation, the value is **null**. |

## Template

A `Template` object represents an instantiated Widget template. Use templates to generate variations from a common codebase through the Kameleoon app interface. A `Template` object contains predefined fields and their values for the associated variation.

**Properties**

| Name | Type | Description |
| - | - | - |
| name | String | Name of the base template. |
| customFields | Object | Map corresponding to the template data. The keys are the names of the fields defined in the base template. The values are the instantiated values that you entered for the associated variation. For example, if you created a template with a single text field `currentDiscount`, `customFields` could equal `{"currentDiscount": "-10% on all orders today!"}`. |
