Experiments API
Quick Start
import RundotGameAPI from '@series-inc/rundot-game-sdk/api'
// Simple feature flag (boolean on/off)
const isNewUIEnabled = await RundotGameAPI.features.getFeatureFlag('new_ui_enabled')
if (isNewUIEnabled) {
showNewInterface()
}A/B Testing with Experiments
// Get experiment with variant information
const experiment = await RundotGameAPI.features.getExperiment('checkout_flow')
// experiment returns:
// {
// name: string, // Experiment name
// ruleID: string, // Rule identifier
// value: any, // Experiment value (e.g., 'variant_a', 'variant_b')
// groupName: string // Group name for analytics
// }
if (experiment?.value === 'variant_b') {
renderVariantB()
} else {
renderVariantA()
}
// Record exposure for analytics
await RundotGameAPI.analytics.recordCustomEvent('experiment_exposure', {
experimentName: experiment.name,
variant: experiment.value,
groupName: experiment.groupName,
})Feature Flags
Feature Gates
API Reference
Method
Returns
Description
How to Set Up an A/B Test
Best Practices
Last updated