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
16
17
18
19
import AbtestingV3
let client = try AbtestingV3Client(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY", region: .us)
let response = try await client.addABTests(addABTestsRequest: AbtestingV3AddABTestsRequest(
name: "myABTest",
variants: [
AbtestingV3AddABTestsVariant.abtestingV3AbTestsVariant(AbtestingV3AbTestsVariant(
index: "AB_TEST_1",
trafficPercentage: 30
)),
AbtestingV3AddABTestsVariant.abtestingV3AbTestsVariant(AbtestingV3AbTestsVariant(
index: "AB_TEST_2",
trafficPercentage: 50
)),
],
metrics: [CreateMetric(name: "myMetric")],
endAt: "2022-12-31T00:00:00.000Z"
))
Did you find this page helpful?