🎉 Try the public beta of the new docs site at algolia.com/doc-beta! 🎉
API client / Methods / A/B Test
Required API Key: any key with the analytics ACL
Method signature
$analytics->getABTests()
$analytics->getABTests([
  // All the following parameters are optional
  'offset' => integer,
  'limit' => integer,
])

We released a new version of the PHP API client in public beta. Read the beta documentation for more information.

We released a new version of the JavaScript API client in public beta. Read the beta documentation for more information.

We released a new version of the Java API client in public beta. Read the beta documentation for more information.

You’re currently reading the JavaScript API client v4 documentation. Check the migration guide to learn how to upgrade from v3 to v4. You can still access the v3 documentation.

You’re currently reading the Ruby API client v2 documentation. Check the migration guide to learn how to upgrade from v1 to v2. You can still access the v1 documentation.

About this method

List A/B tests information and results.

Examples

Read the Algolia CLI documentation for more information.

List all A/B test

1
2
3
4
5
6
7
8
9
$analytics = AnalyticsClient::create(
  'YourApplicationID',
  'YourWriteAPIKey'
);

$analytics->getABTests([
  'offset' => 10,
  'limit' => 20
]);

Parameters

Parameter Description
offset
type: integer
default: 0
Optional

Offset

limit
type: integer
default: 10
Optional

Limit

indexPrefix
type: string
Optional

Filter for A/B tests. Return A/B test variants for which the index name starts with indexPrefix.

indexSuffix
type: string
Optional

Filter for A/B tests. Return A/B test variants for which the index name ends with indexSuffix.

Response

This section shows the JSON response returned by the API. Each API client encapsulates this response inside objects specific to the programming language, so that the actual response might be different. You can view the response by using the getLogs method. Don’t rely on the order of attributes in the response, as JSON doesn’t guarantee the ordering of keys in objects.

JSON format

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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
{
  "count": 1,
  "total": 1,
  "abtests": [
    {
      "abtestID": 102,
      "name": "ABTest custom name",
      "createdAt": "2018-06-04T10:25:40.459519Z",
      "endAt": "2018-06-11T23:59:59Z",
      "status": "active",
      "configuration": {
        "outliers": {
          "exclude": true
        },
        "emptySearch": {
          "exclude": false
        },
      },
      "variants": [
        {
          "averageClickPosition": null,
          "clickCount": null,
          "clickThroughRate": null,
          "conversionCount": null,
          "conversionRate": null,
          "description": "my current scenario description",
          "index": "scout_airports",
          "noResultCount": null,
          "searchCount": null,
          "trackedSearchCount": null,
          "trafficPercentage": 61,
          "userCount": null,
          "trackedUserCount": null,
          "filterEffects": {
            "outliers": {
              "usersCount": 0,
              "trackedSearchesCount": 0
            }
          }
        },
        {
          "averageClickPosition": null,
          "clickCount": null,
          "clickThroughRate": null,
          "conversionCount": null,
          "conversionRate": null,
          "description": "the test scenarios is based on locations",
          "index": "airport_demo_airports",
          "noResultCount": null,
          "searchCount": null,
          "trackedSearchCount": null,
          "trafficPercentage": 39,
          "userCount": null,
          "trackedUserCount": null,
          "filterEffects": {
            "outliers": {
              "usersCount": 1,
              "trackedSearchesCount": 300
            }
          }
        }
      ],
      "clickSignificance": null,
      "conversionSignificance": null
    }
  ]
}
Field Description
count
integer

Number of A/B tests returned.

total
integer

Total number of A/B tests that can be fetched.

abtests
List of abTest

abTest

Field Description
abTestID
integer

ID of the A/B test.

clickSignificance
float

A/B test significance based on click data. Should be > 0.95 to be considered significant (no matter which variant is winning).

conversionSignificance
float

A/B test significance based on conversion data. Should be > 0.95 to be considered significant (no matter which variant is winning)

purchaseSignificance
float

A/B test significance based on purchase conversions. Should be greater than 0.95 to be considered significant, no matter which variant is winning.

addToCartSignificance
float

A/B test significance based on addToCart conversions. Should be greater than 0.95 to be considered significant, no matter which variant is winning.

revenueSignificance
object

A/B test revenue significance for each currency. The object has currency codes as keys and significance scores as values. The object has currency codes as keys and significance scores as values.

createdAt
string

Time at which the A/B test has been created. The date will be in the following format: Y-m-d\TH:i:s\Z

endAt
string

Time at which the A/B test will automatically stop. The date will be in the following format: Y-m-d\TH:i:s\Z

name
string

Name of the A/B test.

status
string

Current status of the A/B test.

variants
list of variant

List of 2 variants:

  • The base index
  • The index to test against
configuration

Configuration parameters for the A/B test.

{
  "outliers": outliers object,
  "emptySearch": emptySearch object
  "minimumDetectableEffect": minimumDetectableEffect object
}

variants âž” variant

Field Description
averageClickPosition
int

Average click position for the variant.

clickCount
int

Distinct click count for the variant.

clickThroughRate
float

Click through rate for the variant.

conversionCount
int

Distinct conversion count for the variant.

conversionRate
float

Conversion rate for the variant.

addToCartCount
int

Distinct number of converted clicks with the eventSubtype set to addToCart and clickAnalytics set to true.

addToCartRate
float

Add-to-cart rate is based on conversion events that have eventSubType set to addToCart, and the total number of tracked searches within the specified timeframe. The rates are computed as the number of add-to-cart conversion events divided by the number of tracked searches.

purchaseCount
int

Distinct number of converted clicks with the eventSubtype set to purchase and clickAnalytics set to true.

purchaseRate
float

Purchase rate is based on conversion events that have eventSubType set to purchase, and the total number of tracked searches within the specified timeframe. The rates are computed as the number of purchase conversion events divided by the number of tracked searches.

description
string

Description of this variant.

estimatedSampleSize
int

Estimated number of searches needed to achieve confidence for this variant. This number is pre-computed and is based on the minimumDetectableEffect configuration parameter.

index
string

Index name for this variant.

noResultCount
int

Number of tracked searches without any results.

searchCount
int

Total number of searches for this variant, including untracked searches.

trackedSearchCount
int

Number of tracked searches. Tracked searches are searches with clickAnalytics enabled.

userCount
int

Total number of users who searched this variant, including untracked users.

trackedUserCount
int

Number of users who searched this variant with at least one search that had clickAnalytics enabled.

currencies
object

Revenue metrics for each currency.

{
  "USD": currency object,
  "EUR": currency object
}
filterEffects

Effects of the configuration filters applied to the variant.

{
  "outliers": filterEffect,
  "emptySearch": filterEffect
}

âž” currency object

Field Description
currency
string

Currency code in ISO 4217 format.

revenue
float

Revenue made in this currency.

mean
float

Mean revenue for this currency.

standardDeviation
float

Standard deviation of revenue for this currency.

âž” configuration object

Field Description
outliers

Configuration for outlier exclusion from metrics calculations.

emptySearch

Configuration for empty search exclusion from metrics calculations.

minimumDetectableEffect

Configuration for minimum detectable effect.

configuration âž” outliers object

Field Description
exclude
boolean

Whether outliers are excluded when calculating A/B test results. Outliers will always be excluded by default unless explicitly set to false.

configuration âž” emptySearch object

Field Description
exclude
boolean

Whether empty searches are excluded when calculating A/B test results.

configuration âž” minimumDetectableEffect object

Field Description
size
float
Required

The size of the minimum detectable effect. This is the smallest relative difference between the variants that you want to be able to detect. For example, if you want to be able to detect a 10% difference between the variants, you should set this to 0.1. The size must be between 0 and 1.

effect
string
Required

The effect that you want to detect. This can be one of the following:

  • conversionRate
  • clickThroughRate
  • purchaseRate
  • addToCartRate

âž” filterEffects object

Field Description
outliers

Configuration effect of outlier exclusion from metrics calculations.

emptySearch

Configuration effect of empty search exclusion from metrics calculations.

âž” filterEffect

Field Description
usersCount
int

Count of users excluded by this filter.

trackedSearchesCount
int

Number of tracked searches excluded by this filter.

Did you find this page helpful?