Install SDK
This topic describes the steps necessary to install the Optimizely Feature Experimentation JavaScript (Browser) SDK into your application.
The JavaScript SDK can be used in a 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>
Important
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 full JavaScript SDK source code is on GitHub.
Requirements
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.
Next
After installing, you need to intialize the SDK.
Updated about 1 month ago