---
metadata:
  - name: generator
    content: Diplodoc Platform v5.54.2
alternate:
  - https://yandex.com/support/varioqub/en/objects/init.md
  - https://yandex.com/support/varioqub/ru/objects/init.md
  - https://yandex.com/support/varioqub/tr/objects/init.md
  - href: en/objects/init.md
    type: text/markdown
    title: Markdown version
  - href: ../llms.txt
    type: text/markdown
    title: llms.txt
---
> **Documentation Index:** Fetch the complete configuration index at https://yandex.com/support/varioqub/en/llms.txt

# init

Initializes the experiment.

```javascript
ymab('metrika.XXXX', 'init', callback);
```

<!-- source: en/_includes/connect/detail.md -->
where `XXXX` is the ID of the Yandex Metrica tag installed on your site.
<!-- endsource: en/_includes/connect/detail.md -->

#|
|| **Argument** | **Type** | **Required** | **Description** ||
||
##init##
|
String
|
Yes
|
Initializes the experiment.
||
||
##callback##
|
Function
|
No
|
Calls the callback function.

Pass this parameter if you're running a [Flags in code](https://yandex.com/support/varioqub/en/create/types/flags.md) experiment. This enables special processing of the Varioqub response.

Format: `(arg: Answer) => void`
||
|#

The `init` function also accepts a different input data format:

```javascript
ymab({
    clientId: 'metrika.XXXX';
    callback: callback;
})
```

```bash
interface InitParams {
     clientId: ClientId;
     i?: string;
     cuid?: string;
     clientFeatures?: Record<string, string>;
     config?: Partial<Config>;
     callback?: (data: Answer) => void;
}
```

#|
|| **Argument** | **Type** | **Required** | **Description** ||
|| ##clientId## | String | No | Yandex Metrica user ID. Format: `metrika.{counter_id}`. Where `{counter_id}` is the Yandex Metrica tag ID. [How to find the tag number](https://yandex.com/support/metrica/en/general/tag-id.html) ||
|| ##i## | String | No | ID of the sample the user is part of.

The ID list can be obtained using the Logs API, while the sample ID can be found in the Varioqub report.

[Learn more about exporting experiment data](https://yandex.com/support/varioqub/en/unload-data.md). ||
|| ##cuid## | String | No | A custom ID that allows you to use your own user IDs in experiments. ||
|| ##clientFeatures## | Object (Record&lt;string, string&gt;) | No | User parameters[*](*parametr).

In the parameters, you can pass the properties of your site's users. For example, you can pass the site authorization flag. ||
|| ##config## | Object (Partial&lt;Config&gt;) | No | Offers additional experiment settings. For more information, see [setConfig](https://yandex.com/support/varioqub/en/objects/set-config.md). ||
|| ##callback## | Function | No | Calls the callback function.

Pass this parameter if you're running a [Flags in code](https://yandex.com/support/varioqub/en/create/types/flags.md) experiment. This enables special processing of the Varioqub response.

Format: `(arg: Answer) => void` ||
|#


## Response format {#response-format}

```javascript
interface Answer {
    flags: Record<string, string[]>;
    i: string;
    experiments: string;
    testids: number[];
}
```

#|
|| **Parameter** | **Type** | **Description** ||
||
##flags##
|
Object
|
Flags set in the experiment if it's a **Flags in code** experiment.
||
||
##i##
|
String
|
Site user's ID.
||
||
##experiments##
|
String
|
Technical data for the Yandex Metrica tag is returned in encrypted form.
||
||
##testids##
|
Array(Integer)
|
Array of IDs of variants successfully targeted by the user.

The value is displayed in the [extended version of Varioqub](https://yandex.com/support/varioqub/en/paid-functionality.md). In the basic version, the array is empty.
||
|#

[*parametr]: To use it in the experiment, activate [the extended version](https://yandex.com/support/varioqub/en/paid-functionality.md).