A/B testing API client (v2)
An updated version of the A/B testing API (v3) is available. For differences, compatibility, and migration guidance, see A/B testing API v2 vs v3.
The A/B testing v2 API client is part of the algoliasearch package.
To install this package, run:
1
npm install algoliasearch
To use the A/B testing v2 client:
1
2
3
4
import { algoliasearch } from "algoliasearch";
const client = algoliasearch("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY");
const abtestingClient = client.initAbtesting({ region: "ALGOLIA_APPLICATION_ID_REGION" });
Replace ALGOLIA_APPLICATION_ID_REGION with your Algolia application’s analytics region: us for the United States or de for Europe.
You can check your analytics region in the Infrastructure > Analytics section of the Algolia dashboard.
The algoliasearch package includes API clients for the Search, Recommend, Analytics, A/B testing, and Personalization API.
If you just want to use the A/B testing v2 API client, you can install its package on its own:
1
npm install @algolia/client-abtesting
To use it, run:
1
2
3
4
5
6
7
import { abtestingClient } from "@algolia/client-abtesting";
const client = abtestingClient(
"ALGOLIA_APPLICATION_ID",
"ALGOLIA_API_KEY",
"ALGOLIA_APPLICATION_ID_REGION"
);
List of methods
Each method makes one request to the A/B testing API v2.
A/B testing
| client.listABTests | List all A/B tests |
| client.addABTests | Create an A/B test |
| client.getABTest | Retrieve A/B test details |
| client.deleteABTest | Delete an A/B test |
| client.stopABTest | Stop an A/B test |
| client.scheduleABTest | Schedule an A/B test |
| client.estimateABTest | Estimate the sample size and duration of an A/B test |