# ABTasty object

The `ABTasty` object is a JavaScript variable containing all the information generate by the tag. It also contains a copy of the datas use by the tag to work.

> Type: object

```javascript
window.ABTasty
```

### Methods

#### `getAccountSettings()`

> Type: function

Return a JSON object containing information about the client's account and his configuration.

```javascript
window.ABTasty.getAccountSettings();
```

Return: `AccountSettings`

**Type: `AccountSettings`**

| Key                                                 | Type                     | Description                                                                                                                                                                                                         |
| --------------------------------------------------- | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **accountIframeException**                          | boolean                  | *(Optional)* Define if tag can be start into an iframe that can access to their parent.                                                                                                                             |
| **accountName**                                     | string                   | Name of the AB Tasty's account.                                                                                                                                                                                     |
| **addJquery**                                       | boolean                  | Define if jQuery is load by the tag.                                                                                                                                                                                |
| **ajaxAutoReload**                                  | boolean                  | Define if tag should be reload on URL change.                                                                                                                                                                       |
| **apiTokenWeborama**                                | string or null           | Token used to call Weborama API in case of Weborama DMP is used into a campaign in play.                                                                                                                            |
| **cedexisRadar**                                    | integer                  | Define if cedexis radar should be used or not. Default and most common value: `0`. Possible other value is `1`.                                                                                                     |
| **customCookieDomain**                              | string or null           | Domain on which tag should depose the cookies. In case of `null` tag will define by itself the domain.                                                                                                              |
| **customCookiePath**                                | string                   | Path on which tag should depose the cookies. Default value: `'/'`.                                                                                                                                                  |
| **datalayerMaxToSend**                              | integer                  |                                                                                                                                                                                                                     |
| **datalayerVariable**                               | string                   | *(Optional)* Name of the variable to use to access to the data layer.                                                                                                                                               |
| **eulerianPixelURL**                                | string or null           | URL to use to link AB Tasty and Eulerian.                                                                                                                                                                           |
| **excludeIE**                                       | boolean                  | **(Deprecated)** No more use by the tag as IE is no more support. [More details](/client-side/tag/readme-1/tag-getting-started.md#browser-compatibility-matrix)                                                     |
| **frameworkVersion**                                | string                   | The actual version of the tag.                                                                                                                                                                                      |
| **getAlwaysWeborama**                               | boolean or null          | Define if tag should request Weborama datas on each page viewed (`true`) or only at the first page of the session (`false`).                                                                                        |
| **globalCode**                                      | string                   | The Javascript put as global code of the account.                                                                                                                                                                   |
| **globalCodeOnDocReady**                            | boolean                  | Define if global code should be execute at the DOM ready (`true`) or directly at the page load (`false`). Default value: `true`.                                                                                    |
| **hashMrasnAllowed**                                | boolean                  | Define if redirection datas should be give by URL parameter (`true`) or by cookie (`false`). Default value: `true`.                                                                                                 |
| **heatmapRight**                                    | boolean                  | Define if the account have access to the heatmap feature.                                                                                                                                                           |
| **id**                                              | integer                  | Unique ID of the AB Tasty's account.                                                                                                                                                                                |
| **identifier**                                      | string                   | Unique identifier of the AB Tasty's account.                                                                                                                                                                        |
| **isSecureCookie**                                  | boolean                  | Define if tag should use the secure option of the cookie. Default value: `false`.                                                                                                                                   |
| **jqueryVarName**                                   | string or null           | Name of the variable to use to access to the jQuery install on the website.                                                                                                                                         |
| **kruxNamespace**                                   | string or null           |                                                                                                                                                                                                                     |
| **omnitureIntegration**                             | integer                  | *(Optional)* Type of omniture integration use by the account. Possible values: `0` or `1` or `2`. Default value: `0`.                                                                                               |
| **oneVisitorOneTest**                               | boolean                  | Define if account is using the 1 visitor 1 test feature.                                                                                                                                                            |
| **pack**                                            | string                   | The type of pack the account is using. Possible values `premium` or `quota`.                                                                                                                                        |
| **quota**                                           | integer                  |                                                                                                                                                                                                                     |
| **runAsThread**                                     | integer                  |                                                                                                                                                                                                                     |
| **sessionRecordingRights**                          | boolean                  | Define account has right to use Session Recording feature.                                                                                                                                                          |
| **storageMode**                                     | string                   | Define if `ABTasty` datas should be saved in to `'cookies'` or `localStorage` (value `'local'`).                                                                                                                    |
| **tealiumAccountName**                              | string or null           | Name of the Tealium account to use.                                                                                                                                                                                 |
| **tealiumProfileName**                              | string or null           | Profile of the Tealium account to use.                                                                                                                                                                              |
| **toleranceParams**                                 | array of strings         | The parameters to remove from URL send to the Universal Collect. Useful if you want to not send sensitive datas.                                                                                                    |
| **toleranceRegex**                                  | string or null           | The regex to remove from URL send to the Universal Collect. Useful if you want to not send sensitive datas.                                                                                                         |
| **waitForConsent**                                  | object                   | Object containing the configuration of the consent restrictions.                                                                                                                                                    |
| **waitForConsent.data**                             | string or object or null | Data to use for each consent mode. String for `custom_js` and `didomi` ; Object for `specific_cookie` or null for other modes.                                                                                      |
| **waitForConsent.isStrict**                         | boolean                  | Define if the tag should wait the consent before starting.                                                                                                                                                          |
| **waitForConsent.campaignRestrictions**             | object                   | Object containing the configuration about campaign restriction execution.                                                                                                                                           |
| **waitForConsent.campaignRestrictions.test**        | boolean                  | If equal to `true` the "test" campaigns could be executed ; if `false` they can't be executed.                                                                                                                      |
| **waitForConsent.campaignRestrictions.perso**       | boolean                  | If equal to `true` the "personalization" campaigns could be executed ; if `false` they can't be executed.                                                                                                           |
| **waitForConsent.campaignRestrictions.redirection** | boolean                  | If equal to `true` the "redirection" campaigns could be executed ; if `false` they can't be executed.                                                                                                               |
| **waitForConsent.campaignRestrictions.aa**          | boolean                  | If equal to `true` the "A/A" campaigns could be executed ; if `false` they can't be executed.                                                                                                                       |
| **waitForConsent.campaignRestrictions.patch**       | boolean                  | If equal to `true` the "Patch" campaigns could be executed ; if `false` they can't be executed.                                                                                                                     |
| **waitForConsent.mode**                             | string                   | Define which method tag should use before deposit cookie or sending hit. Possible values: `'disabled'` or `'custom_js'` or `'specific_cookie'` or `'any_cookie'` or `'user_action'` or `'third_party'` or `didomi`. |

#### `getTestsOnPage()`

> Type: function

Return a JSON object containing the datas about the current actives campaigns on the page.

```javascript
window.ABTasty.getTestsOnPage([campaign_id]);
```

| Argument         | Type    | Description                                                |
| ---------------- | ------- | ---------------------------------------------------------- |
| **campaign\_id** | integer | *(Optional)* The campaign Id for which you want the datas. |

Return: An object with the `campaign_id` as key and `CampaignPublicType` as value.

**Type: `CampaignPublicType`**

| Key                                                   | Type    | Description                                                                                                                                      |
| ----------------------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| **name**                                              | string  | The name of the campaign.                                                                                                                        |
| **status**                                            | string  | The actual status of the campaign. Possible values: `accepted` or `accepted_by_redirection`.                                                     |
| **targetings**                                        | object  | All the datas about the targeting of the campaign.                                                                                               |
| **targetings.qaParamaters.cookie\_scope.conditions**  | object  | The conditions of the QA option "Cookie".                                                                                                        |
| **targetings.qaParamaters.cookie\_scope.success**     | boolean | Define the success of the QA option "Cookie". Should be `true`.                                                                                  |
| **targetings.qaParamaters.ip\_scope.conditions**      | object  | The conditions of the QA option "IP address".                                                                                                    |
| **targetings.qaParamaters.ip\_scope.success**         | boolean | Define the success of the QA option "IP address". Should be `true`.                                                                              |
| **targetings.segment**                                | array   | All the datas about the segment part of the targeting.                                                                                           |
| **targetings.segment\[].audiencePosition**            | integer | Index in the segments array of the segment to which the criteria belongs to.                                                                     |
| **targetings.segment\[].audienceName**                | string  | Name of the segment to which the criteria belongs to.                                                                                            |
| **targetings.segment\[].conditions**                  | object  | The conditions of the segment criteria.                                                                                                          |
| **targetings.segment\[].group**                       | integer | Number of the group segment criteria to which criteria come from.                                                                                |
| **targetings.segment\[].name**                        | string  | The name of the segment criteria.                                                                                                                |
| **targetings.segment\[].operator**                    | string  | The operator use between the conditions of the segment criteria.                                                                                 |
| **targetings.segment\[].success**                     | boolean | Define the success of the segment criteria.                                                                                                      |
| **targetings.segment\[].targeting\_type**             | integer | The type of the segment criteria.                                                                                                                |
| **targetings.targetPages.code\_scope.conditions**     | object  | The condition of the "where" criteria "Code".                                                                                                    |
| **targetings.targetPages.code\_scope.success**        | boolean | Define the success of the "where" criteria "Code". Should be `true`.                                                                             |
| **targetings.targetPages.selector\_scope.conditions** | object  | The conditions of the "where" criteria "CSS selector".                                                                                           |
| **targetings.targetPages.selector\_scope.success**    | boolean | Define the success of the "where" criteria "CSS selector". Should be `true`.                                                                     |
| **targetings.targetPages.url\_scope.conditions**      | object  | The conditions of the "where" criteria "URL".                                                                                                    |
| **targetings.targetPages.url\_scope.success**         | boolean | Define the success of the "where" criteria "URL". Should be `true`.                                                                              |
| **targetings.trigger**                                | array   | All the datas about the trigger part of the targeting.                                                                                           |
| **targetings.trigger\[].audiencePosition**            | integer | Index in the triggers array of the trigger to which the criteria belongs to.                                                                     |
| **targetings.trigger\[].audienceName**                | string  | Name of the trigger to which the criteria belongs to.                                                                                            |
| **targetings.trigger\[].conditions**                  | object  | The conditions of the trigger criteria.                                                                                                          |
| **targetings.trigger\[].group**                       | integer | Number of the group trigger criteria to which criteria come from.                                                                                |
| **targetings.trigger\[].name**                        | string  | The name of the trigger criteria.                                                                                                                |
| **targetings.trigger\[].operator**                    | string  | The operator use between the conditions of the trigger criteria.                                                                                 |
| **targetings.trigger\[].success**                     | boolean | Define the success of the trigger criteria.                                                                                                      |
| **targetings.trigger\[].targeting\_type**             | integer | The type of the trigger criteria.                                                                                                                |
| **testDatas**                                         | object  | A copy of the raw datas used by the tag to make the campaign works. It contains all the information extract from the database for this campaign. |
| **type**                                              | string  | Type of the campaign. Possible values: `ab` or `subsegment`.                                                                                     |
| **variationID**                                       | integer | The ID of the actual active variation.                                                                                                           |
| **variationName**                                     | string  | The name of the actual active variation.                                                                                                         |

#### `getCampaignHistory()`

> Type: function

Return a JSON object containing all the campaign which are in play and variation seen by the visitor.

```javascript
window.ABTasty.getCampaignHistory();
```

Return: `SeenCampaigns`

**Example:**

Visitor have seen following campaigns:

* A/B Test: `246802` - Variation: `346802` *(currently in play)*
* A/B Test: `257901` - Variation: `357913` *(currently in pause)*
* Sub-Test: `467903` - Variation: `367819` - Master campaign: `467902` - Master variation: `367818` *(currently in play)*

JSON returned by the function will be:

```json
{
  "246802": 346802,
  "467902": 367818,
  "467903": 367819
}
```

#### `getGeoloc()`

> Type: function

Return a JSON object containing the information about the geolocation of the visitor. If the service of Geolocation has never been called, then it return `null`.

```javascript
window.ABTasty.getGeoloc();
```

Return: `null` | `GeolocResponse`

:::info

* The geolocation data is only available when there is at least one of the following targeting criterion used on an **active** campaign: IP / Geolocation / Weather.
* The weather data is only available if a weather targeting condition is active for the whole account (any active campaigns). :::

**Type: `GeolocResponse`**

| Key                                        | Type    | Description                                                                                                                                                                                       |
| ------------------------------------------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **accuracy\_radius**                       | integer | The approximate accuracy radius, in kilometers, around the latitude and longitude for the geographical entity (country, subdivision, city or postal code) associated with the IP address.         |
| **city**                                   | string  | Name of the city associated with the IP address.                                                                                                                                                  |
| **city\_confidence**                       | integer | A value from 0-100 representing our confidence that the city is correct.                                                                                                                          |
| **city\_id**                               | integer | A unique identifier for the city as specified by [GeoNames](https://www.geonames.org/).                                                                                                           |
| **country\_iso\_code**                     | string  | A two-character [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) country code for the country associated with the IP address.                                                               |
| **country\_name**                          | string  | Name of the country associated with the IP address.                                                                                                                                               |
| **ip\_address**                            | string  | The requested IP address.                                                                                                                                                                         |
| **latitude**                               | float   | The approximate [WGS84](https://en.wikipedia.org/wiki/World_Geodetic_System) latitude of the postal code, city, subdivision or country associated with the IP address.                            |
| **least\_specific\_subdivision.name**      | string  | Name of the least specific region associated with the IP address.                                                                                                                                 |
| **least\_specific\_subdivision.iso\_code** | string  | A string of up to three characters containing the region-portion of the [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2) code for the least specific region associated with the IP address. |
| **longitude**                              | float   | The approximate [WGS84](https://en.wikipedia.org/wiki/World_Geodetic_System) longitude of the postal code, city, subdivision or country associated with the IP address.                           |
| **most\_specific\_subdivision.name**       | string  | Name of the most specific region associated with the IP address.                                                                                                                                  |
| **most\_specific\_subdivision.iso\_code**  | string  | A string of up to three characters containing the region-portion of the [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2) code for the most specific region associated with the IP address.  |
| **postal\_code**                           | string  | A postal code close to the user’s location.                                                                                                                                                       |
| **state**                                  | string  |                                                                                                                                                                                                   |
| **state\_iso\_code**                       | string  |                                                                                                                                                                                                   |
| **time\_zone**                             | string  | The time zone associated with location, as specified by the [IANA Time Zone Database](https://www.iana.org/time-zones).                                                                           |
| **weather.temperature**                    | float   | *(Optional)* Temperature in Celsius.                                                                                                                                                              |
| **weather.main**                           | string  | *(Optional)* Group of weather parameters (Rain, Snow, Extreme etc.).                                                                                                                              |
| **weather.description**                    | string  | *(Optional)* Weather condition within the group.                                                                                                                                                  |

*For more details you can check the Maxmind documentation* [*here*](https://dev.maxmind.com/geoip/geoip2/web-services/)*.*

#### `getParsedUserAgent()`

:::caution Deprecated method please prefer to use `window.ABTasty.getParsedUserAgentAsync()`. :::

> Type: function

Return a JSON object containing the information about the device and browser of the visitor. If the service of UserAgent has never been called, then it return `null`.

```javascript
window.ABTasty.getParsedUserAgent();
```

Return: `undefined` | `UAResponse`\
\--> [UAResponse details](https://gitlab.com/abtasty/team/product-management/gitbook-documentation/-/blob/main/developers-doc/tag/tag-cookies.mdx#abtastyua-)

#### `getParsedUserAgentAsync()`

> Type: function

Return a promise to get a JSON object containing the information about the device and browser of the visitor. If the service of UserAgent has been called yet it return immediatly the object, if not is gonna to make the call and return the data after if success. If service's call failed it's promise is returning `undefined`.

```javascript
(async () => {
  await window.ABTasty.getParsedUserAgentAsync();
})();
```

Return: `Promise<UAResponse | undefined>`\
\--> [UAResponse details](https://gitlab.com/abtasty/team/product-management/gitbook-documentation/-/blob/main/developers-doc/tag/tag-cookies.mdx#abtastyua-)

#### `getAbandonedCart()`

> Type: function

Returns a promise to get a JSON object containing the information about the last abandoned cart for this visitor. If the service has been already called, it immediately returns the object, otherwise the data is being fetched. If failing, the promise would return `undefined`.

```javascript
(async () => {
  await window.ABTasty.getAbandonedCart([identifier, visitorId, reset]);
})();
```

Return: `Promise<AbandonedCartResponse | undefined>`\
\--> [AbandonedCartResponse details](https://gitlab.com/abtasty/team/product-management/gitbook-documentation/-/blob/main/developers-doc/tag/tag-cookies.mdx#abtastyabandonedcart-)

**Parameters:**

| Name       | Type    | Description                                                                                                                                                                                                                        |
| ---------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| identifier | string  | *(Optional)* The ID of the account you are getting data from. By default, the tag will use the current identifier `window.ABTasty.accountData.accountSettings.identifier`.                                                         |
| visitorId  | string  | *(Optional)* The visitor ID you are getting data from, should be linked to the `identifier`. By default, the tag will use the current id `window.ABTasty.visitor.id`.                                                              |
| reset      | boolean | *(Optional)* A boolean to define if you want to reset the internal memory of the tag. Remember to remove the `ABTastyAbandonedCart` session storage entry if you need fresher data from the remote source. Default value: `false`. |

#### `clearSessionCookie()`

:::danger Do not use this function on production code. It's mainly for QA and debugging purpose. :::

> Type: function

Remove the `ABTastySession` cookie.

```javascript
window.ABTasty.clearSessionCookie();
```

#### `clearCookie()`

:::danger Do not use this function on production code. It's mainly for QA and debugging purpose. :::

> Type: function

Remove the `ABTasty` cookie.

```javascript
window.ABTasty.clearCookie();
```

#### `clearAllCookies()`

:::danger Do not use this function on production code. It's mainly for QA and debugging purpose. :::

> Type: function

Remove the `ABTasty` and `ABTastySession` cookies.

```javascript
window.ABTasty.clearAllCookies();
```

#### `WeboramaCallback`

:::danger Do not call this function by yourself. It's for a Tag usage only. :::

> Type: function

Allow the Tag to know when Weborama data are successfully fetched.

```javascript
window.ABTasty.WeboramaCallback(data);
```

| Argument | Type   | Description                                                                |
| -------- | ------ | -------------------------------------------------------------------------- |
| **data** | object | Data provide by Weborama about the audiences to which visitor is affected. |

#### `TealiumCallback`

:::danger Do not call this function by yourself. It's for a Tag usage only. :::

> Type: function

Allow the Tag to know when Tealium AudienceStream data are successfully fetched.

```javascript
window.ABTasty.TealiumCallback(data);
```

| Argument | Type   | Description                                                                              |
| -------- | ------ | ---------------------------------------------------------------------------------------- |
| **data** | object | Data provide by Tealium AudienceStream about the audiences to which visitor is affected. |

### Variable properties

#### `started`

> Type: boolean

Define if the tag has started its execution (true) or not (false). If its execution is limited by a cookie restriction policy, it is still considered as started.

`started` can be `false` or not defined when:

* editor is loading
* preview is loading
* tag is locked with `window.lockABTastyTag`
* strict mode is on
* quota is overrun
* ....

```javascript
window.ABTasty.started
```

#### `accountData`

> Type: object

A copy of all the raw datas used by the tag to work (settings of the account / campaign configuration / widgets code etc.).

```javascript
window.ABTasty.accountData
```

| Key                                          | Type   | Description                                                                                                |
| -------------------------------------------- | ------ | ---------------------------------------------------------------------------------------------------------- |
| **accountSettings**                          | object | All the datas about account and its configuration. See [`getAccountSettings()`](#getaccountsettings).      |
| **crossDomainSettings**                      | object | Settings about the cross-domain tracking feature                                                           |
| **crossDomainSettings\[].url**               | string | Value to match with current URL to define if cross-domain tracking feature should be used on the page.     |
| **crossDomainSettings\[].method**            | string | Method to compare current URL and value. Possible values: `substring` or `regex` or `exact`.               |
| **crossDomainSettings\[].includeOrExeclude** | string | Define if we should activate the feature on the current page (`include`) or not (`exclude`).               |
| **customVariables**                          | array  | Datas about automatic visitor attributes to send based on the URL of the current page.                     |
| **customVariables\[].action**                | string | The value of the visitor attribute.                                                                        |
| **customVariables\[].category**              | string | The name of the visitor attribute.                                                                         |
| **customVariables\[].method**                | string | The method to determine if segment hit should be send. Possible values: `substring` or `regex` or `exact`. |
| **customVariables\[].url**                   | string | The value to use during comparaison with URL.                                                              |
| **obsoletes**                                | array  | The campaign IDs that have been paused since more than 14 days and less than 126 days.                     |
| **tests**                                    | object | The datas of the campaigns currently in play.                                                              |
| **widgets**                                  | object | The code of the widgets depending of the version. Only widgets that are used into campaigns in play.       |

#### `datalayerEnabled`

> Type: boolean

Define if data layer is defined on the page or not.\
\&#xNAN;*It's using the `ABTasty.accountData.accountSettings.datalyerVariable` to check if data layer is defined.*

```javascript
window.ABTasty.datalayerEnabled
```

#### `visitor`

> Type: Object

Information about the current visitor. All the information are generated by the Tag and unique to the visitor.

```javascript
window.ABTasty.visitor
```

| Key    | Type   | Description                                                                                      |
| ------ | ------ | ------------------------------------------------------------------------------------------------ |
| **id** | string | A unique Id used by AB Tasty to track the visitor. It could be retrieve in the `ABTasty` cookie. |

#### `temporaryCookieValues`

> Type: Object

Allow the Tag to temporary saved the cookies in case that consent is not ready yet.

```javascript
window.ABTasty.temporaryCookieValues
```

| Key                | Type   | Description                        |
| ------------------ | ------ | ---------------------------------- |
| **ABTasty**        | string | A copy of `ABTasty` cookie.        |
| **ABTastySession** | string | A copy of `ABTastySession` cookie. |

#### `results`

> Type: Object

Return all the campaigns that are live on the website, even if you are not on the right page. In this case, the status will specify if you are seeing a campaign or not, and if not, why you are not seeing it.

```javascript
window.ABTasty.results
```

Return: An object with the `campaign_id` as key and `CampaignResultsType` as value.

**Type: `CampaignResultsType`**

| Key                                                   | Type                 | Description                                                                                                                                                                                                                 |
| ----------------------------------------------------- | -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **name**                                              | string               | The name of the campaign.                                                                                                                                                                                                   |
| **status**                                            | string               | The actual status of the campaign. Possible values described [here](https://gitlab.com/abtasty/team/product-management/gitbook-documentation/-/blob/main/developers-doc/tag/tag-campaigns-types/README.md#campaign-status). |
| **targetings**                                        | object               | All the datas about the targeting of the campaign.                                                                                                                                                                          |
| **targetings.qaParamaters.cookie\_scope.conditions**  | object               | *(Optional)* The conditions of the QA option "Cookie".                                                                                                                                                                      |
| **targetings.qaParamaters.cookie\_scope.success**     | boolean              | *(Optional)* Define the success of the QA option "Cookie".                                                                                                                                                                  |
| **targetings.qaParamaters.ip\_scope.conditions**      | object               | *(Optional)* The conditions of the QA option "IP address".                                                                                                                                                                  |
| **targetings.qaParamaters.ip\_scope.success**         | boolean              | *(Optional)* Define the success of the QA option "IP address".                                                                                                                                                              |
| **targetings.segment**                                | array                | *(Optional)* All the datas about the segment part of the targeting.                                                                                                                                                         |
| **targetings.segment\[].audiencePosition**            | integer              | *(Optional)* Index in the segments array of the segment to which the criteria belongs to.                                                                                                                                   |
| **targetings.segment\[].audienceName**                | string               | *(Optional)* Name of the segment to which the criteria belongs to.                                                                                                                                                          |
| **targetings.segment\[].conditions**                  | object               | *(Optional)* The conditions of the segment criteria.                                                                                                                                                                        |
| **targetings.segment\[].group**                       | integer              | *(Optional)* Number of the group segment criteria to which criteria come from.                                                                                                                                              |
| **targetings.segment\[].name**                        | string               | *(Optional)* The name of the segment criteria.                                                                                                                                                                              |
| **targetings.segment\[].operator**                    | string               | *(Optional)* The operator use between the conditions of the segment criteria.                                                                                                                                               |
| **targetings.segment\[].success**                     | boolean              | *(Optional)* Define the success of the segment criteria.                                                                                                                                                                    |
| **targetings.segment\[].targeting\_type**             | integer              | *(Optional)* The type of the segment criteria.                                                                                                                                                                              |
| **targetings.targetPages.code\_scope.conditions**     | object               | *(Optional)* The condition of the "where" criteria "Code".                                                                                                                                                                  |
| **targetings.targetPages.code\_scope.success**        | boolean              | *(Optional)* Define the success of the "where" criteria "Code".                                                                                                                                                             |
| **targetings.targetPages.selector\_scope.conditions** | object               | *(Optional)* The conditions of the "where" criteria "CSS selector".                                                                                                                                                         |
| **targetings.targetPages.selector\_scope.success**    | boolean              | *(Optional)* Define the success of the "where" criteria "CSS selector".                                                                                                                                                     |
| **targetings.targetPages.url\_scope.conditions**      | object               | *(Optional)* The conditions of the "where" criteria "URL".                                                                                                                                                                  |
| **targetings.targetPages.url\_scope.success**         | boolean              | *(Optional)* Define the success of the "where" criteria "URL".                                                                                                                                                              |
| **targetings.trigger**                                | array                | *(Optional)* All the datas about the trigger part of the targeting.                                                                                                                                                         |
| **targetings.trigger\[].audiencePosition**            | integer              | *(Optional)* Index in the triggers array of the trigger to which the criteria belongs to.                                                                                                                                   |
| **targetings.trigger\[].audienceName**                | string               | *(Optional)* Name of the trigger to which the criteria belongs to.                                                                                                                                                          |
| **targetings.trigger\[].conditions**                  | object               | *(Optional)* The conditions of the trigger criteria.                                                                                                                                                                        |
| **targetings.trigger\[].group**                       | integer              | *(Optional)* Number of the group trigger criteria to which criteria come from.                                                                                                                                              |
| **targetings.trigger\[].name**                        | string               | *(Optional)* The name of the trigger criteria.                                                                                                                                                                              |
| **targetings.trigger\[].operator**                    | string               | *(Optional)* The operator use between the conditions of the trigger criteria.                                                                                                                                               |
| **targetings.trigger\[].success**                     | boolean              | *(Optional)* Define the success of the trigger criteria.                                                                                                                                                                    |
| **targetings.trigger\[].targeting\_type**             | integer              | *(Optional)* The type of the trigger criteria.                                                                                                                                                                              |
| **type**                                              | string               | Type of the campaign. Possible values: `ab`, `multipage`, `multivariate`, `mastersegment` or `subsegment`.                                                                                                                  |
| **sub\_type**                                         | string               | *(Optional)* Sub-type of the campaign. Possible values: `ab`, `patch`, `mpt`, `mvt`, `sp`, `mpp` or `mep`.                                                                                                                  |
| **additionalType**                                    | string               | *(Optional)* Additional-type of the campaign computed by the tag *(mainly used for consent management)*. Possible values: `aa`, `patch`, or `redirection`.                                                                  |
| **variationID**                                       | integer or undefined | The ID of the actual active variation.                                                                                                                                                                                      |
| **variationName**                                     | string or null       | The name of the actual active variation.                                                                                                                                                                                    |

#### `consentReady`

> Type: boolean

Define if AB Tasty's tag has the consent to work and collect (`true`) or not (`false`).

```javascript
window.ABTasty.consentReady
```

#### `cnilReady`

:::caution Deprecated variable please prefer to use `window.ABTasty.consentReady`. :::

> Type: boolean

Define if AB Tasty's tag has the consent to work and collect (`true`) or not (`false`).

```javascript
window.ABTasty.cnilReady
```

#### `pendingUAParser`

> Type: boolean

Define if AB Tasty's tag is currently fecthing User-Agent information like device or browser (`true`) or not (`false`).

```javascript
window.ABTasty.pendingUAParser
```

#### `DCInfos`

:::caution Information about geolocation and weather are deprecated. Please prefer to use `window.ABTasty.getGeoloc()`. :::

> Type: Object

A JSON object containing the information about Advalo and Eulerian DMP.

```javascript
window.ABTasty.DCInfos
```

| Key                              | Type   | Description                                                               |
| -------------------------------- | ------ | ------------------------------------------------------------------------- |
| **DMPInfos**                     | object | Information about DMP Advalo and/or Eulerian                              |
| **DMPInfos\[].partern**          | string | Id of the partern from which the information come                         |
| **DMPInfos\[].segment**          | string | The name of the segment define by the DMP                                 |
| **DMPInfos\[].value**            | string | The value of the segment define by the DMP                                |
| **DMPInfos\[].expiration\_date** | number | The segment expiration date define by the DMP *(only for used by Advalo)* |

#### `urlHistory`

> Type: Object

Object containing information about current and previous page. *(Useful for previous page criteria on SPA websites)*

```javascript
window.ABTasty.urlHistory
```

| Key          | Type   | Description              |
| ------------ | ------ | ------------------------ |
| **current**  | string | URL of the current page  |
| **previous** | string | URL of the previous page |

#### `ADBlockEnabled`

> Type: boolean

Define if an adBlocking extension is activating on the browser (`true`) or not (`false`).

```javascript
window.ABTasty.ADBlockEnabled
```

#### `AdBlockDetectionFailed`

> Type: boolean

Define if the Tag's detection of an adBlocking extension has failed (`true`) or not (`false`).

```javascript
window.ABTasty.AdBlockDetectionFailed
```

#### `datalayerEnabled`

> Type: boolean

Define if the Tag's detection of the data layer has failed (`true`) or not (`false`).

```javascript
window.ABTasty.datalayerEnabled
```

#### `pendingRedirection`

> Type: boolean

Define if the Tag's is currently doing a redirection (`true`) or not (`false`).

```javascript
window.ABTasty.pendingRedirection
```

#### `redirectedFrom`

> Type: Object

An object containing information about the redirection. Data come from the `mrasn` query param or from the `ABTastySession` cookie key `mrasn`.

```javascript
window.ABTasty.redirectedFrom
```

| Key                 | Type    | Description                                                                                    |
| ------------------- | ------- | ---------------------------------------------------------------------------------------------- |
| testID              | integer | The campaign Id that cause the redirection                                                     |
| variationID         | integer | The variation Id that cause the redirection                                                    |
| previousLogicalView | string  | The logical view hash of the previous page use to invalidate the hit sent on the original page |

#### `appliedPlugins`

> Type: array

An array containing the Id *(`string`)* of the widgets that are currently applied on the page.

```javascript
window.ABTasty.appliedPlugins
```

#### `eventState`

> Type: object

For every JavaScript events dispatched by the tag you can find a status in this variable.\
You can find a description and an explanation of how to use it in the [dedicated documentation](https://gitlab.com/abtasty/team/product-management/gitbook-documentation/-/blob/main/developers-doc/tag/tag-javascript-events/README.md#event-state).

```javascript
window.ABTasty.eventState
```

#### `hitServiceNotifierSubscribe`

> Type: object

This service is responsible for listening to all the events happening on the client and for making the event and their payload available to use. To subscribe to the event, call the `hitServiceNotifierSubscribe` method with the following parameters:

```javascript
window.ABTasty.hitServiceNotifierSubscribe(fn_callback, [event_type], [settings])
```

| Argument         | Type     | Description                                                                                                                                                                             |
| ---------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **fn\_callback** | function | Function to execute when the event is emitted ex. (\[event\_data]: Object, \[event\_settings]: Object) => void.                                                                         |
| **event\_type**  | string   | *(Optional)* Event to listen (CAMPAIGN, PAGE, EVENT, SEGMENT, TRANSACTION, ITEM, NPS ).                                                                                                 |
| **settings**     | object   | *(Optional)* all settings data needed by connector (ex. testIds: if you want subscribe to only events for these campaigns, withHitHistory for getting the hit history of current page). |

**Example:**

```javascript
window.ABTasty.hitServiceNotifierSubscribe(eventData => console.log(eventData)), 'CAMPAIGN', { withHitHistory: true });
```

`event_data` is a JSON object containing the following informations:

| Key       | Type    | Description                  |
| --------- | ------- | ---------------------------- |
| type      | string  | type of event                |
| timestamp | integer | Date when event is triggered |
| data      | Object  | hit payload                  |

`event_settings` is a JSON object containing the following informations:

| Key        | Type   | Description                                                                         |
| ---------- | ------ | ----------------------------------------------------------------------------------- |
| observerId | number | Identifier of subscriber. You can use it to unsubscribe to the notification service |

To unsubscribe to the event, call the `hitServiceNotifierUnSubscribe` method with the following parameters:

```javascript
window.ABTasty.hitServiceNotifierUnSubscribe(observerId)
```

| Argument       | Type   | Description                                              |
| -------------- | ------ | -------------------------------------------------------- |
| **observerId** | number | observerId can be obtained from `fn_callback`'s settings |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.abtasty.com/client-side/tag/tag-window-abtasty.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
