LogoLogo
Support
Product Discovery Developer Guide
Product Discovery Developer Guide
  • 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

Copyright @ 2024 Crownpeak Technology, Inc. All rights reserved.

On this page
  1. A/B testing
  2. Fredhopper A/B testing
  3. Integration steps for a caching solution
  4. Java SDK Integration

Retrieve running A/B tests - Java SDK

As mentioned in the previous section, once the AbTesting object has been initialized and start() has been called, the SDK commences with periodic requests to retrieve and cache the currently running A/B tests.

 import com.attraqt.sdk.fhr.abtesting.AbTesting

...

AbTesting abTesting = AbTesting.builder()
                               .abTestsServerUrl("url")
                               .username("username")
                               .password("password")       
                               .build();

abTesting.start();

Important! The AbTesting object should be created and started once per application instance and shared between web requests.

Once the retrieval has started, you can call the isStarted() method to check whether the process is started, like so:

boolean isStarted = abTesting.isStarted();

Additionally, if you want to stop the retrieval, you can call the shutdown() method which will stop the retrieval and clean up any of the cached results.

abTesting.shutdown();

Important! The SDK works completely in memory so any stored queries and data will be available for as long as the application is running.

When you have your retrieval of running A/B tests fully functioning you can move on to the next section which covers the filtering of the A/B tests for a given page, and assigning variants to the user.

PreviousSetupNextFilter and request variant - Java SDK

Last updated 3 years ago

๐Ÿงช
Filter and request variant - Java SDK