Sep 20, 2024
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
20
21
22
23
24
25
26
27
using Algolia.Search.Clients;
using Algolia.Search.Http;
using Algolia.Search.Models.Abtesting;
var client = new AbtestingClient(
new AbtestingConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", "ALGOLIA_APPLICATION_REGION")
);
var response = await client.EstimateABTestAsync(
new EstimateABTestRequest
{
Configuration = new EstimateConfiguration
{
EmptySearch = new EmptySearch { Exclude = true },
MinimumDetectableEffect = new MinimumDetectableEffect
{
Size = 0.03,
Metric = Enum.Parse<EffectMetric>("ConversionRate"),
},
},
Variants = new List<AddABTestsVariant>
{
new AddABTestsVariant(new AbTestsVariant { Index = "AB_TEST_1", TrafficPercentage = 50 }),
new AddABTestsVariant(new AbTestsVariant { Index = "AB_TEST_2", TrafficPercentage = 50 }),
},
}
);
Did you find this page helpful?