What is @splitsoftware/splitio?
@splitsoftware/splitio is a feature flagging and experimentation platform that allows you to manage feature rollouts, run A/B tests, and perform real-time analytics. It helps in delivering features to users in a controlled manner, enabling you to test and iterate quickly.
What are @splitsoftware/splitio's main functionalities?
Feature Flagging
This feature allows you to manage feature flags, enabling or disabling features for specific users or groups. The code sample demonstrates how to initialize the Split.io client and check the status of a feature flag for a user.
const splitio = require('@splitsoftware/splitio');
const factory = splitio({ core: { authorizationKey: 'YOUR_API_KEY' } });
const client = factory.client();
client.on(client.Event.SDK_READY, () => {
const treatment = client.getTreatment('user123', 'feature_flag_name');
if (treatment === 'on') {
// Feature is enabled
} else {
// Feature is disabled
}
});
A/B Testing
This feature allows you to run A/B tests by assigning different treatments (variants) to users. The code sample shows how to determine which variant a user should see based on the experiment configuration.
const splitio = require('@splitsoftware/splitio');
const factory = splitio({ core: { authorizationKey: 'YOUR_API_KEY' } });
const client = factory.client();
client.on(client.Event.SDK_READY, () => {
const treatment = client.getTreatment('user123', 'experiment_name');
if (treatment === 'variant_a') {
// Show variant A
} else if (treatment === 'variant_b') {
// Show variant B
}
});
Real-time Analytics
This feature allows you to track user events and conversions in real-time. The code sample demonstrates how to track a purchase event for a user, which can be used for analytics and reporting.
const splitio = require('@splitsoftware/splitio');
const factory = splitio({ core: { authorizationKey: 'YOUR_API_KEY' } });
const client = factory.client();
client.on(client.Event.SDK_READY, () => {
client.track('user123', 'conversion', 'purchase', 100);
});
Other packages similar to @splitsoftware/splitio
launchdarkly-node-server-sdk
LaunchDarkly is a feature management platform that provides similar functionality to Split.io, including feature flagging, A/B testing, and real-time analytics. It offers a robust set of tools for managing feature rollouts and experiments.
Split SDK for JavaScript
Split SDK is the library you should use for integrate Split
into your web platform.
Release documentation
Usage documentation
How to release
Versioning
Update the package.json with the correct value using semver.
1.0.0-canary.0 => First candidate to be fully verified.
1.0.0-canary.1 => Second candidate to be fully verified.
1.0.0-canary.2 => Third candidate to be fully verified.
1.0.0 => Stable release
Publishing into NPM
- Use
npm publish --tag canary
=> release canary version. - Use
npm publish
=> release the stable version.
Building
npm run build
=> ES6 and ES5 versions of the code.npm run build-umd
=> UMD version of the code (development).npm run build-min
=> UMD version of the code but minified.
CI
use latest LTS version of NodeJS
nvm install v4
nvm use v4
Upgrade to latest npm
npm install -g npm@latest
Install dependencies
npm install
Add binaries to the PATH
export PATH=$(npm bin):$PATH
Add localhost file for tests!!!
printf "%s\n" '# this a comment' 'my_new_feature on' '# another comment' > $HOME/.split
For SonarQ since the plugin is in Java 8
jdk_switcher use oraclejdk8
Tests steps
npm run lint
npm run test-browser-ci
npm run test-browser-e2e-ci
npm run test-node