Jun 23, 2025
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
Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import com.algolia.api.AbtestingV3Client;
import com.algolia.config.*;
AbtestingV3Client client = new AbtestingV3Client("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", "ALGOLIA_APPLICATION_REGION");
client.estimateABTest(
new EstimateABTestRequest()
.setConfiguration(
new EstimateConfiguration().setMinimumDetectableEffect(
new MinimumDetectableEffect().setSize(0.03).setMetric(EffectMetric.CONVERSION_RATE)
)
)
.setVariants(
Arrays.asList(
new AbTestsVariant().setIndex("AB_TEST_1").setTrafficPercentage(50),
new AbTestsVariant().setIndex("AB_TEST_2").setTrafficPercentage(50)
)
)
);
Did you find this page helpful?