---
metadata:
  - name: generator
    content: Diplodoc Platform v5.54.2
alternate:
  - https://yandex.com/support/varioqub/en/objects/set-config.md
  - https://yandex.com/support/varioqub/ru/objects/set-config.md
  - https://yandex.com/support/varioqub/tr/objects/set-config.md
  - href: en/objects/set-config.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

# setConfig

Offers additional experiment settings and the ability to create experiments in the [JS visual editor mode](https://yandex.com/support/varioqub/en/create/types/visual.md#setting).

```javascript
ymab('metrika.XXXX', 'setConfig', {
    enableVisual: true,
    enableJS: false,
    enableHTML: true,
    enableRedir: true,
    enableWatch: false,
    enableAdv: true,
    enableSendYmUid: true,
    enableSetYmUid: false,
    cookieDomain: undefined,
    storeReferer: false,
    storeRedirParam: "localstorage",
    removeAbRedirParam: false,
    nonce: undefined
});
```

<!-- 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** ||
|| ##setConfig## | String | Yes | Initializes the experiment. ||
|| **Fields** | > | > | > ||
|| 
##enableVisual## 
| 
Boolean 
| 
— 
| 
Enables experiments with the editor. 

Default value: `true`. 
||
|| 
##enableJS## 
| 
Boolean 
| 
— 
| 
Enables experiments with JavaScript code insertion through the editor. 

Default value: `false`. 

Ignored if `enableVisual` is `false`. 
||
|| 
##enableHTML## 
| 
Boolean 
| 
— 
| 
Enables experiments with HTML code insertion through the editor.

Default value: `true`.

Ignored if `enableVisual` is `false`. 
||
|| 
##enableRedir## 
| 
Boolean 
| 
— 
| 
Enables experiments with redirects. 

Default value: `true`. 
||
|| 
##enableWatch## 
| 
Boolean 
| 
— 
| 
Enables page change tracking.

Default value: `false`.

{% cut "Details" %}

When set to `true`, changes to the page's elements are constantly tracked from the moment the page is first loaded. When a change is detected, Varioqub scans the page again and applies the experiment to the new elements.

{% endcut %} ||

|| ##enableAdv## 
| 
Boolean 
| 
— 
| 
Enables experiments with ad units.

Default value: `true`. 
||
|| 
##enableSendYmUid## 
| 
Boolean 
| 
— 
| 
Enables sending Yandex Metrica cookies to `uaas.yandex.ru`. 

Default value: `true`. 
||
|| 
##enableSetYmUid## 
| 
Boolean 
| 
— 
| 
Enables setting Yandex Metrica cookies.

Default value: `false`.

Ignored if `enableSendYmUid` is `false`.

To run [experiments on ad units](https://yandex.com/support2/partner/en/web/units/experiments) in the Yandex Advertising Network, set the `enableSetYmUid` parameter to `true`. 
||
|| 
##cookieDomain## 
| 
String 
| 
— 
| 
Defines the domain for setting cookies.

Default value: `undefined`.

If `cookieDomain` is undefined, cookies will be set on the domain of the current page.

{% cut "Example" %}

If the site `example.com` has subdomains — for example, `ny.example.com` and `help.example.com` — cookies will be set for each individual subdomain.
If a user enters a different subdomain in the address bar, they will be directed to different experiments. To prevent this, specify the domain `example.com` in the `cookieDomain`. Then all subdomains will have the same cookies, and users will be directed to the same experiments.

{% endcut %} ||

|| 
##storeReferer## 
| 
Boolean 
| 
— 
| 
Enables saving the **Referer** in the **sessionStorage** upon redirect so that it can be sent to Yandex Metrica.

Default value: `false`.

Use it when you need to save tags after a redirect. ||
||
##storeRedirParam##
|
String
|
—
|
Defines the temporary storage for a flag indicating a successful redirect. This flag is used to log the session in Yandex Metrica upon redirect.

Flags can be stored for up to five minutes. After a successful redirect, flags are automatically deleted.

Possible values:

#|
|| **Value** | **Where to store the flag** ||
||
`localstorage`
|
Browser local storage.
||
||
`cookie`
|
Browser cookie file.
||
||
`get`
|
GET parameter in the URL of the landing page.

Use it when you need to send redirect information directly in the address bar.
||
|#

Default value: `localstorage`.

||
||
##removeAbRedirParam## {#removeAbRedirParam}
|
Boolean
|
—
|
Enables removal of the `ab_redir` parameter from the page URL upon successful redirect.

Default value: `false`.

In [experiments with redirects](https://yandex.com/support/varioqub/en/create/types/redirect.md), the `ab_redir` parameter is added automatically when a redirect occurs in the control variant.
||
|| ##nonce## | String | — | Added to CSS and JS if the site uses a [Content Security Policy](https://www.w3.org/TR/CSP/). [Learn more](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/nonce) ||
|#

#### **Example of enabling JS**

```javascript
ymab('metrika.XXXX', 'setConfig', { enableJS: true});
```

#### **Example of passing a nonce**

```javascript
ymab('metrika.XXXX', 'setConfig', { enableJS: true, nonce: 'nonce-<sequence of characters>' });
```

Call `setConfig` before the [init](https://yandex.com/support/varioqub/en/objects/init.md) method.

Example:

```javascript

```

<!-- 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 -->

## FAQ and troubleshooting

[Can I use a custom JS script in an A/B test?](https://yandex.com/support/varioqub/en/faq.md#js-script)

[How do I disable a specific experiment type for an entire site or page?](https://yandex.com/support/varioqub/en/faq.md#disable-experiment-type)

[An element loads after the page. How do I include it in the experiment?](https://yandex.com/support/varioqub/en/faq.md#element-after-download)

[*yan]: Yandex Advertising Network