API client / Methods / A/B Test
Required API Key: any key with the analytics ACL
Method signature
$analytics->getABTest(integer abTestID);

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

Get an A/B test information and results.

Examples

Read the Algolia CLI documentation for more information.

Get an A/B test

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

$analytics->getABTest(42);

Parameters

Parameter Description
abTestID
type: integer
Required

The A/B test id that was sent back in the response of the add A/B test method

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
{
  "abTestID": 78,
  "clickSignificance": 1,
  "conversionSignificance": 0.9937,
  "createdAt": "2018-05-15T17:52:15.644906Z",
  "endAt": "2018-05-17T23:59:59Z",
  "name": "Custom Ranking salesRank Test",
  "status": "stopped",
  "configuration": {
    "outliers": {
      "exclude": true
    }
  },
  "variants": [
    {
      "averageClickPosition": 0,
      "clickCount": 17115,
      "clickThroughRate": 0.19839107906664039,
      "conversionCount": 11508,
      "conversionRate": 0.13339670101658765,
      "description": "",
      "index": "atis-abtest-default",
      "noResultCount": 0,
      "searchCount": 86269,
      "trackedSearchCount": 70365,
      "trafficPercentage": 70,
      "userCount": 55501,
      "trackedUserCount": 44197,
      "filterEffects": {
          "outliers": {
            "usersCount": 0,
            "trackedSearchesCount": 0
          }
       }
    },
    {
      "averageClickPosition": 0,
      "clickCount": 7716,
      "clickThroughRate": 0.20869847452125934,
      "conversionCount": 5129,
      "conversionRate": 0.13872660391647734,
      "description": "",
      "index": "atis-abtest-salesRank",
      "noResultCount": 0,
      "searchCount": 36972,
      "trackedSearchCount": 30459,
      "trafficPercentage": 30,
      "userCount": 22694,
      "trackedUserCount": 21356,
      "filterEffects": {
          "outliers": {
            "usersCount": 1,
            "trackedSearchesCount": 300
          }
       }
    }
  ]
}
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. This object has currency codes as keys and the 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
}

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 the variant.

index
string

Index name of the 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 for this variant. Tracked searches are searches with clickAnalytics enabled.

userCount
int

Total number of users who searched on 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.

configuration âž” outliers object

Field Description
exclude
boolean

Whether outliers are excluded when calculating A/B test results.

configuration âž” emptySearch object

Field Description
exclude
boolean

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

âž” 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

Count of tracked searches excluded by this filter.

Did you find this page helpful?