getFlags
Calls the init method and returns the flags in the callback function.
ymab('metrika.XXXX', 'getFlags', callback);
where XXXX
is the ID of the Yandex Metrica tag installed on your site.
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 |
Invokes the callback function. Pass this parameter to get additional information. Format: |
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:
ymab('metrika.xxxx', 'getFlags', function(flags) {
for (const [key, value] of Object.entries(flags)) {
window.postMessage({ key, value: value[0] }, '*');
}
});
where XXXX
is the ID of the Yandex Metrica tag installed on your site.
FAQ and troubleshooting
Was the article helpful?
Previous
Next