HomeGuidesAPI Reference
Submit Documentation FeedbackJoin Developer CommunityOptimizely GitHubOptimizely NuGetLog In

Install SDK

This topic describes the steps necessary to install the Optimizely JavaScript (Browser) SDK.

The JavaScript SDK can be used in browser and is distributed through:

  • npm
  • yarn
  • a prebuilt UMD bundle of the JavaScript SDK, which allows installing the SDK via an HTML .
npm install --save @optimizely/optimizely-sdk
yarn add @optimizely/optimizely-sdk
<script src="https://unpkg.com/@optimizely/optimizely-sdk/dist/optimizely.browser.umd.min.js"></script>



We do not recommend using the unpkg script tag installation method in production as it introduces a third-party performance dependency, and will not be explicitly version-locked by default


The JavaScript SDK requires an ES5-compatible environment, as well as Promise. To run in environments that don't support Promise, you can use promise-polyfill.


After installing, you need to intialize the SDK.

Source code

The full source code is at index.ts.