JavaScript Feature Flags

Split's JavaScript SDK provides robust, scalable feature flag management, giving any team the power to safely launch features and target them to users.

Begin your free trial today.

Why use Split for JavaScript feature flags?

Split’s JavaScript SDK brings free, scalable feature flags to any app, website or experience built with JavaScript. Split helps teams control rollouts, and customer experiences, while gathering new data and insight on how their products are being engaged.

Front-end teams are always experimenting with new things, trying to make the website, the app, or the business more successful. But each new experiment or quickly-turned-around feature introduces risk—that response times will be slower, that a change in the funnel will add friction, that your users simply may not like the change. Split puts all of these issues under your control, by letting you:

  • Release features to production but disabled for all users by default
  • Target new features only to internal QA teams
  • Slowly roll out features to a broader audience by percentage, demographic, geography, account type, or any other metric
  • Kill features with a single click to revert back to your safe state

Split works across many different languages, letting developers, PMs and support teams control feature rollout from one unified view—and monitor the success of any new code. Our integrations bring rollout updates into the tools your team is already using, further opening the feature-delivery process up to your entire organization.

Using Split with Javascript Frameworks

Split’s JavaScript SDK works with today’s most popular JS frameworks right out of the box invocation, with no extra steps necessary. This includes popular favorites like Ember, AngularJS, Backbone and React.

Using Split for NodeJS feature flags.

Node is a runtime environment, not a framework, and has its own special considerations that must be taken into account to properly execute feature flagging. Because of this, Split has its own Node SDK for use with the Split feature flag.

Our Node SDK is published using NPM, so you don’t have to change your existing workflow to integrate Split. Get started with our Node SDK documentation, or learn more about the package at

See how thredUP uses Split in Node.JS (and Ruby) to safely launch features and target deals.

Dan DeMeyere, VP Engineering, thredUP

Getting Started with Split for JavaScript

All of Split’s SDKs are very simple to integrate into your code base; that’s no different in JavaScript. All it really takes to get rolling with Split is initiating the SDK, then splitting your code.

Initiating the SDK

First, you’ll want to add a reference to our CDN location, for quicker initial loading:

          <script src="//"></script>

That tag will expose our SDK to a factory function called ‘splitio’. You’re now able to quickly create an instance as follows:

          const factory = splitio({
  core: {
    authorizationKey: 'YOUR_API_KEY',
    // the customer id can be the logged in
    // user id, or the account id that
    // the logged in user belongs to.
    // The type of customer (user, account, custom)
    // is chosen during Split's sign-up process.
    key: 'CUSTOMER_ID'

var client = factory.client();

And that’s it.

Splitting your code.

With the SDK instantiated, it’s now time to start splitting your code base. Find a feature you’d like to split, and wrap it in the split feature flag like so:

          var treatment = sdk.getTreatment("FEATURE_NAME");

if (treatment == "on") {
// show your new feature under control
} else if (treatment == "off") {
// continue using your old feature for the rest of your users
} else {
// provide a default path just in case the SDK is still starting up


Or you can react to changes by subscribing to the update event that’s triggered on the SDK instance:

          client.on(client.Event.SDK_UPDATE, function() {
  console.log('The SDK has been updated!');

The Split JavaScript SDK integrates seamlessly into your code; no other changes or dependencies are needed to get Split up and running.

To continue diving into Split, sign up for a free account today, or dig into our Documentation.