Crownpeak
  • Product Discovery Developer Guide
  • 🛒Item catalog management
    • What is the Items API?
    • How to work with Items
      • Item Schema
        • Attributes
        • Nested Item Schemas
        • Using the Item Schema API
        • DefaultLocale API
        • Onboarding on/migrating to Fredhopper
        • List of Reserved Attributes
      • Category Tree
        • Using the Category Tree API
        • Onboarding on XO
      • Item Catalog
        • Using the Catalog API
      • Items
        • Using the streaming Items API
        • Using the batch Items API
    • Step by Step guide
      • Step by step guide for Fredhopper customers
    • Feedback
      • Using the Feedback API
    • Authorization to APIs
    • Troubleshooting API errors
  • 🎯XO Recommendations
    • Introduction
    • Using the Recommendations API
    • Setting up the Chrome extension
    • Micro-segmentation
    • XO Legacy APIs
  • 🔎XO Search
    • Introduction
    • Getting started
    • API Reference
      • Search API
      • Autocomplete API (Beta)
      • Product Suggest API
    • API Parameters
      • Search
      • Pagination
      • Faceting
      • Sorting
      • Grouping
      • Filtering
      • Disable features
      • Response mask
      • Context
    • Configuration limitation
  • 🧪A/B testing
    • Fredhopper A/B testing
      • Integration steps for a non-caching solution
      • Integration steps for a caching solution
        • Java SDK Integration
          • Setup
          • Retrieve running A/B tests - Java SDK
          • Filter and request variant - Java SDK
          • Extending the SDK
        • Manual A/B tests integration
          • Retrieve running A/B tests
          • Filter out irrelevant A/B tests
          • Assign variants to user
          • Request variant for page
        • Limitations and Best Practices
  • 📚Resources
    • Glossary
    • Best Practices
      • Tracker Best Practices
      • Items API Best Practices
      • Fredhopper Data Configuration Best Practices
      • Fredhopper Query Response Best Practices
      • Fredhopper Merchandising Studio Best Practices
    • Privacy Notice
  • Archived Pages
    • FHR Tracking plan
    • XO Tracking plan
    • The Tracking API and JS Library
      • What to Track
        • Generic Actions
          • View
          • Click
          • Add to Cart
          • Remove from Cart
          • Purchase
        • Custom Actions
      • Initializing the JavaScript Library
      • REST API Technical Documentation
Powered by GitBook
On this page
  • Request
  • Regex Compatibility
  • Response
  • Caching
  1. A/B testing
  2. Fredhopper A/B testing
  3. Integration steps for a caching solution
  4. Manual A/B tests integration

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

X-Request-Language: nodejs

X-Request-Language: php

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>>
    }
]
[
    {
      "id": "318ccefa-bb47-4589-945d-ccc0c4f32280",
      "variations":[
         {
            "id": "06c26226-25bc-4054-b622-62fcbe4db3fd",
            "weight":50
         },
         {
            "id": "4f4bdc48-a586-4670-985b-b8de7d028773",
            "weight":50
         },
      ],
      "filters": {
         "fh_location": ["//catalog01/en_GB/color>{black}.*"],
      }
    },
    {
      "id": "bc616167-c12a-4277-9de3-e37ba66e2dd9",
      "variations":[
         {
            "id": "d541195a-b2e4-4135-8fee-58d335a0dc43",
            "weight":30
         },
         {
            "id": "e014178b-3ce5-404d-960f-d6edc30ed790",
            "weight":30
         },
         {
            "id": "cd84c34e-a58c-43b7-bf7d-3ccb90ed3fcc",
            "weight":40
         },
      ],
      "filters": {
         "fh_location": ["//catalog01/en_GB/.*spotlight>{new}.*"],
      }
    }
]

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.

PreviousManual A/B tests integrationNextFilter out irrelevant A/B tests

Last updated 3 years ago

🧪
Filter out irrelevant A/B tests