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
require "algolia"
client = Algolia::AbtestingV3Client.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", "ALGOLIA_APPLICATION_REGION")
response = client.estimate_ab_test(
Algolia::AbtestingV3::EstimateABTestRequest.new(
configuration: Algolia::AbtestingV3::EstimateConfiguration.new(
minimum_detectable_effect: Algolia::AbtestingV3::MinimumDetectableEffect.new(
size: 0.03,
metric: "conversionRate"
)
),
variants: [
Algolia::AbtestingV3::AbTestsVariant.new(index: "AB_TEST_1", traffic_percentage: 50),
Algolia::AbtestingV3::AbTestsVariant.new(index: "AB_TEST_2", traffic_percentage: 50)
]
)
)
Did you find this page helpful?