Retrieve running A/B tests

A single page may have multiple A/B tests active for it at the same time. This means that the page has a version for every combination of variants between the A/B tests. As every new version of the page is essentially a new entry you need to cache, using only the running or active A/B tests for a certain page reduces the amount of entries we need to cache, as the non-active ones aren't relevant.

Request

Retrieving all the running A/B tests can be done via the following GET request to FHR:

${base_url}/config/running/ab-tests

Where ${base_url} will be provided to you by the technical consultant appointed to you. This URL is different then the one used for FHR queries, though the same authentication credentials can be used.

Regex Compatibility

The default RegExes found in the response are compatible with Java. In order to get RegExes compatible with a certain language you will need to add the header X-Request-Language with the language you want as the value.

X-Request-Language: java

Response

If your request is successful you would receive a JSON response like the following:

[
    {
      "id": String,
      "variations":[
         {
            "id": String,
            "weight":int
         }
      ],
      "filters": Map<String, List<String>>
    }
]

The response will be a list of objects, each populated with:

  • id - the id of the A/B test.

  • variations - a list of objects consisting of:

    • id - the id of the variation.

    • weight - the weight distribution for the given variation (percentage).

  • filters - an object or map where:

    • key is a property used when making the FHR query - most notably fh_location

    • value is a list of RegEx strings used to filter out pages that don't have the given A/B test active on them

Caching

Running A/B tests are relatively static, they only get updated when you add or amend an A/B test and publish the changes in Merchandising Studio. Because of this, the running AB tests response is highly cacheable. In order to ensure your service is both performant and up to date we suggest refreshing the running AB tests response every 5 minutes.

Everything mentioned in this section is also covered via the SDK.

Once you have the running A/B tests you can move onto filtering.

pageFilter out irrelevant A/B tests

Last updated