Estimate the sample size and duration of an A/B test

Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.

Usage

Required ACL: analytics
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import AbtestingV3

let client = try AbtestingV3Client(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY", region: .us)

let response = try await client.estimateABTest(estimateABTestRequest: AbtestingV3EstimateABTestRequest(
    configuration: AbtestingV3EstimateConfiguration(minimumDetectableEffect: AbtestingV3MinimumDetectableEffect(
        size: 0.03,
        metric: AbtestingV3EffectMetric.conversionRate
    )),
    variants: [
        AbtestingV3AddABTestsVariant.abtestingV3AbTestsVariant(AbtestingV3AbTestsVariant(
            index: "AB_TEST_1",
            trafficPercentage: 50
        )),
        AbtestingV3AddABTestsVariant.abtestingV3AbTestsVariant(AbtestingV3AbTestsVariant(
            index: "AB_TEST_2",
            trafficPercentage: 50
        )),
    ]
))
Did you find this page helpful?