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
  • Prerequisites
  • Requesting the page
  • Example flow
  1. A/B testing
  2. Fredhopper A/B testing
  3. Integration steps for a caching solution
  4. Manual A/B tests integration

Request variant for page

Prerequisites

By this point, you should have completed the previous steps and have the following information at hand for the page you want to request from FHR:

  • the running A/B tests for the page

  • the variants of the A/B tests for the user viewing the page

If you're missing the above information please refer to the previous steps in this section.

Requesting the page

In order to request a variant of the given FHR page, all you need to do is supply one extra parameter to the FHR query - fh_abtests. _**_With that parameter you specify which A/B tests and which one of their variants should be applied to the page.

The format of the fh_abtests query parameter should be a semicolon(;) separated string, of A/B test id and variant id combinations separated by a colon(:) - i.e. - it should follow the format:

test-1:variant-for-test-1;test-2:variant-for-test-2;test-3:variant-for-test-3;...

While different users will have different versions of the same page as different A/B test variants are applied, the total number of different combinations possible will be limited so you would benefit from caching this request so whenever a new user is assigned the same variants, you wouldn't need to make a repeated request.

Important! While the order in which the A/B tests are supplied in the request has no effect on the response, you should keep the same order between requests to ensure the query parameters match so that caching works as expected.

Example flow

An example flow for requesting the page would look something like the following:

  • You request all the running A/B tests. You get a total of three tests:

    • ab-test-1 with variant-a and variant-b

    • ab-test-2 with variant-a and variant-b

    • ab-test-3 with variant-a, variant-b and variant-c

  • You perform filtering of the running A/B tests for the page you want to request and learn that only ab-test1 and ab-test-3 are active on it.

  • You perform variant selection for the user of the two tests, and assign variant-a for ab-test-1 and variant-c for ab-test-3.

  • You put the selections into the fh_abtests parameter in the requested format:

    • fh_abtests=ab-test-1:variant-a;ab-test-3:variant-c

  • You make the request and receive the correct version.

  • You cache the response, and return it whenever a new user is assigned the same variants.

PreviousAssign variants to userNextLimitations and Best Practices

Last updated 3 years ago

🧪