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

# getFlags

Calls the [init](https://yandex.com/support/varioqub/en/objects/init.md) method and returns the flags in the callback function.

```javascript
ymab('metrika.XXXX', 'getFlags', 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** ||
|| 
##getFlags## 
| 
String 
| 
Yes 
| 
Initializes the experiment and returns its flags if it's a **Flags in code** experiment. 
||
|| 
##callback## 
| 
Function 
| 
Recommended 
| 
Calls the callback function.

Pass this parameter to get additional information.

Format: `(arg: Record<string, string[]>) => void` ||
|#

## Method usage example

To pass the flags set up for your **Flags in code** experiment as messages to the browser window, you can implement the following function:

```javascript
ymab('metrika.xxxx', 'getFlags', function(flags) {
    for (const [key, value] of Object.entries(flags)) {
        window.postMessage({ key, value: value[0] }, '*');
    }
});
```

<!-- 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 {#faq}

[Can I add a redirect to a different domain?](https://yandex.com/support/varioqub/en/faq.md#international-redirect)
