Jun 23, 2025
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
require "algolia"
client = Algolia::AbtestingV3Client.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", "ALGOLIA_APPLICATION_REGION")
response = client.add_ab_tests(
Algolia::AbtestingV3::AddABTestsRequest.new(
end_at: "2022-12-31T00:00:00.000Z",
name: "myABTest",
metrics: [Algolia::AbtestingV3::CreateMetric.new(name: "myMetric")],
variants: [
Algolia::AbtestingV3::AbTestsVariant.new(index: "AB_TEST_1", traffic_percentage: 30),
Algolia::AbtestingV3::AbTestsVariant.new(index: "AB_TEST_2", traffic_percentage: 50)
]
)
)
Did you find this page helpful?