> ## 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.

# Kameleoon.API.Personalizations

> Reference for the Kameleoon.API.Personalizations methods that read, turn off, and trigger live personalizations.

This module provides methods to access live personalizations.

## disable

The `disable()` method marks a personalization as turned off. Use this for interactive elements like pop-ins. When a user closes the element, call `disable()` to update the personalization status. Kameleoon automatically implements this call for native, non-custom interface elements.

```javascript theme={null}
let personalizationID = 12345;
Kameleoon.API.Personalizations.disable(personalizationID);
```

**Arguments**

| Name | Type | Description |
| - | - | - |
| id | Number | Id of the personalization. This field is mandatory. |

## getActive

The `getActive()` method returns active personalizations for the current visit and page. A personalization is active if its variation code has executed and the associated action remains visible. To retrieve personalizations that triggered on other URLs or that are now closed, such as pop-ins, use `getTriggeredInVisit()`.

```javascript theme={null}
if (Kameleoon.API.Personalizations.getActive().length == 0) {
  Kameleoon.API.Events.trigger("No Personalizations Events");
}
```

**Return value**

| Name | Type | Description |
| - | - | - |
| personalizations | Array | List of [Personalization objects](https://docs.kameleoon.com/developer-docs/apis/activation-api-js/api-reference/objects/experiment-and-personalization.md#personalization). |

## getAll

The `getAll()` method returns all live personalizations (running, not draft/paused/stopped).

```javascript theme={null}
Kameleoon.API.Personalizations.getAll().forEach(function (personalization) {
  if (personalization.id == 123456 && personalization.active) {
    console.log(personalization.name);
  }
});
```

**Return value**

| Name | Type | Description |
| - | - | - |
| personalizations | Array | List of [Personalization objects](https://docs.kameleoon.com/developer-docs/apis/activation-api-js/api-reference/objects/experiment-and-personalization.md#personalization). |

## getById

The `getById()` method returns the personalization for the specified ID.

```javascript theme={null}
var personalization = Kameleoon.API.Personalizations.getById(123456);

if (personalization && personalization.active) {
  console.log(personalization.name);
}
```

**Arguments**

| Name | Type | Description |
| - | - | - |
| id | Number | Id of the personalization. This field is mandatory. |

**Return value**

| Name | Type | Description |
| - | - | - |
| personalization | Object | [Personalization object](https://docs.kameleoon.com/developer-docs/apis/activation-api-js/api-reference/objects/experiment-and-personalization.md#personalization). |

## getByName

The `getByName()` method returns the personalization for the specified name.

```javascript theme={null}
var personalization = Kameleoon.API.Personalizations.getByName("MyPersonalizationName");

if (personalization && personalization.active) {
  console.log(personalization.id);
}
```

**Arguments**

| Name | Type | Description |
| - | - | - |
| name | String | Name of the personalization. This field is mandatory. |

**Return value**

| Name | Type | Description |
| - | - | - |
| personalization | Object | [Personalization object](https://docs.kameleoon.com/developer-docs/apis/activation-api-js/api-reference/objects/experiment-and-personalization.md#personalization). |

## getTriggeredInVisit

The `getTriggeredInVisit()` method returns all personalizations triggered during the current visit.

```javascript theme={null}
Kameleoon.API.Personalizations.getTriggeredInVisit().forEach(function (personalization) {
  if (personalization.id == 123456) {
    console.log(personalization.name);
  }
});
```

**Return value**

| Name | Type | Description |
| - | - | - |
| personalizations | Array | List of [Personalization object](https://docs.kameleoon.com/developer-docs/apis/activation-api-js/api-reference/objects/experiment-and-personalization.md#personalization). |

## getActivatedInVisit

The `getActivatedInVisit()` method returns all personalizations activated during the current visit.

```javascript theme={null}
Kameleoon.API.Personalizations.getActivatedInVisit().forEach(function (personalization) {
  if (personalization.id == 123456) {
    console.log(personalization.name);
  }
});
```

**Return value**

| Name | Type | Description |
| - | - | - |
| personalizations | Array | List of [Personalization object](https://docs.kameleoon.com/developer-docs/apis/activation-api-js/api-reference/objects/experiment-and-personalization.md#personalization). |

## trigger

The `trigger()` method forces a personalization to trigger, bypassing targeting segment conditions. This action initiates the personalization but might not activate it.

```javascript theme={null}
let personalizationID = 123456;
Kameleoon.API.Personalizations.trigger(personalizationID, true);
```

**Arguments**

| Name | Type | Description |
| - | - | - |
| personalizationID | Number | ID of the personalization. This field is mandatory. |
| trackingOnly | Boolean | Set to **true** for external personalizations (targeting or tracking managed by Kameleoon) to perform only tracking actions without executing variation assets (JS, CSS, redirections). If omitted, the method defaults to **false**. |
