Configuration Options
The Hyppot JavaScript SDK provides several configuration options to customize its behavior. This guide explains all available configuration options and how to use them.
When initializing Hyppot, you use the configureHyppot
function which accepts a configuration callback:
import { configureHyppot } from 'hyppot';
const { resolver, tracker } = configureHyppot((config) => {
// Configuration options go here
});
Available Configuration Options
Custom Hyppot Prefix
The prefix
option sets the base URL path for all API requests to the Hyppot backend service. This should be in line with the PathPrefix
in your backend configuration
config.prefix = '/hyppot'; // Default value
Experiment Status Storage Key
The experimentStatusKey
option defines the key used to store experiment data in the browser's session storage.
config.experimentStatusKey = "Hyppot_Ex"; // Default value
You might want to change this if:
- You're running multiple instances of Hyppot on the same domain
- You want to namespace your storage keys to avoid conflicts
- You have specific naming conventions for storage keys
config.experimentStatusKey = "MyApp_Experiments";
Automatic Impression Tracking
The autoTrackImpressions
option controls whether impressions are automatically tracked when an experiment is resolved. By default, this is set to true
.
config.autoTrackImpressions = true; // Default value
When set to false
, impressions will not be automatically tracked when calling resolver.resolve()
. This can be useful if:
- You want to manually control when impressions are tracked
- You need to defer impression tracking until a specific user action
- You're implementing custom impression tracking logic
// Disable automatic impression tracking
config.autoTrackImpressions = false;
Note: When automatic tracking is disabled, you can still manually track impressions using the tracker.trackImpression()
method.