Sep 20, 2024
Create an A/B test
Creates a new A/B test.
Usage
Required ACL:
editSettings
Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from algoliasearch.abtesting.client import AbtestingClientSync
from json import loads
# In an asynchronous context, you can use AbtestingClient instead, which exposes the exact same methods.
client = AbtestingClientSync(
"ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", "ALGOLIA_APPLICATION_REGION"
)
response = client.add_ab_tests(
add_ab_tests_request={
"endAt": "2022-12-31T00:00:00.000Z",
"name": "myABTest",
"variants": [
{
"index": "AB_TEST_1",
"trafficPercentage": 30,
},
{
"index": "AB_TEST_2",
"trafficPercentage": 50,
},
],
},
)
Did you find this page helpful?