Usersplit API
Tip
You need developer skills to work with the Usersplit API. If you don't have these skills, contact your website developer or webmaster.
The Usersplit API is intended for connecting Varioqub to your site.
Request format
GET https://uaas.yandex.ru/v1/exps
? [client_id=<String>]
& [url=<String>]
& [i=<String>]
& [client_features=<String>]
& [cuid=<String>]
client_id |
Yandex Metrica user ID. Format: |
url |
The address of the page with GET parameters where the visitor is located. If no URL is passed, Varioqub uses the referer from the headers. However, in some cases it may not be possible to send the referer in full or at all. For this reason, we recommend always passing the URL. |
i |
Site visitor's ID stored in first-party cookies. Make sure to set it in the We recommend passing it in each API request. The field may be empty in the first request. |
client_features |
A serialized JSON object containing user parameters*. Example: |
cuid |
A custom ID that allows you to use your own user IDs in experiments. To enable this functionality, implement the passing of the GET parameter |
Note
The Usersplit API also uses Referer
, User-Agent
, and X-Forwarded-For
to group users by samples. Make sure that they are transmitted correctly.
HEADERS:
Referer: {url}
User-Agent: {user-agent}
X-Forwarded-For: {user_ip}
where:
-
url
is the full URL, including GET parameters, of the page browsed by the user. -
user-agent
is the User Agent of the site visitor. -
user_ip
is the IP address of the site user.
Response format
JSON
{
"i":"{i}",
"experiments":"{experiments}",
"testids": [
{testid.1},
...
{testid.n}
],
"flags":
[
{
"n":"{flag.1}",
"v":"{value.1}",
"t":"{type.1}"
},
...
{
"n":"{flag.n}",
"v":"{value.n}",
"t":"{type.n}"
}
]
}
Field name |
Description |
i |
Site user's ID stored in first-party cookies. Make sure to set it in the |
experiments |
Technical data for the Yandex Metrica tag. Returned in encrypted form. Once received, pass the data to Yandex Metrica when initializing the tag or by a separate call. |
testids |
Array of IDs of variants successfully targeted by the user. The value is displayed in the extended version of Varioqub. In the basic version, the array is empty. |
flags |
Array of flags that define experimental changes. The array consists of |
t |
Flag type. It can have the |
n |
Flag name. |
v |
Flag value. |
Note
The response format may contain additional fields. When processing the response, use only the fields required for working with the API.
Response example:
{
"i":"7ASX7O3PO+SD4f30Y1GqkUEVIgyJ+lqpl9teI7DtiRQTGlsMT8VszxKsrU/2D5+mTTJviiKIv2/2
obmd4t7fGkefkfY=",
"experiments":"JjfiHndoV8s",
"flags":
[
{
"n":"flag_name",
"v":"value",
"t":"flag"
}
],
"testids": [
1234,
4567
],
}
Passing technical data to Yandex Metrica
To transmit technical data, use the experiments
method. You can call this method either when initializing a tag or separately.
ym(XXXXXX, 'experiments', experiments);
Parameter | Type | Description |
---|---|---|
experiments | String | Technical data for Yandex Metrica, such as information on the variants used in the experiment. The data is returned in encrypted form after calling the Usersplit API method. |
Contact support
Required parameter.
Yandex Metrica user ID. Format: metrika.{counter_id}
. Where {counter_id}
is the Yandex Metrica tag ID. How to find the tag ID
Full URL, including GET parameters, of the page browsed by the user.
If no URL is passed, Varioqub uses the referer from the headers. However, in some cases it may not be possible to send the referer in full or at all. For this reason, we recommend always passing the URL.
Site user's ID stored in first-party cookies. Make sure to set it in the _ymab_param
cookie upon receiving the response. It may be empty during the user's first visit to the site.
We recommend passing it in each API request. The field may be empty in the first request.
To use it in the experiment, activate the extended version.
A serialized JSON object containing user parameters. Example: {"param2": "value2", "param1": "value1"}
.
A custom ID that allows you to use your own user IDs in experiments.
To enable this functionality, implement the passing of the GET parameter cuid
on the site. The value of the parameter needs to correspond to the user ID.