init
Initializes the experiment.
ymab('metrika.XXXX', 'init', callback);
where XXXX
is the ID of the Yandex Metrica tag installed on your site.
Argument |
Type |
Required |
Description |
init |
String |
Yes |
Initializes the experiment. |
callback |
Function |
No |
Invokes the callback function. Pass this parameter if you're running a Flags in code experiment. This enables special processing of the Varioqub response. Format: |
The init
function also accepts a different input data format:
ymab({
clientId: 'metrika.XXXX';
callback: callback;
})
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: |
i |
String |
No |
ID of the sample to which the user was sorted. The ID list can be obtained using the Logs API, while the sample ID can be found in the Varioqub report. |
cuid |
String |
No |
A custom ID that allows you to use your own user IDs in experiments. |
clientFeatures |
Object (Record<string, string>) |
No |
User parameters*. 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<Config>) |
No |
Offers additional experiment settings. For more information, see setConfig. |
callback |
Function |
No |
Invokes the callback function. Pass this parameter if you're running a Flags in code experiment. This enables special processing of the Varioqub response. Format: |
Response format
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. Returned in encrypted form. |
testids |
Array(Integer) |
Array containing the IDs of the variants associated with the request. The value is displayed in the extended version of Varioqub. In the basic version, the array is empty. |
To use it in the experiment, activate the extended version.