Disclaimer: This website requires Please enable JavaScript in your browser settings for the best experience.

The availability of features may depend on your plan type. Contact your Customer Success Manager if you have any questions.

Dev guideRecipesAPI ReferenceChangelog
Dev guideAPI ReferenceRecipesChangelogUser GuideGitHubDev CommunityOptimizely AcademySubmit a ticketLog In
Dev guide
GitHubDev CommunityOptimizely AcademySubmit a ticket

Optimizely developer documentation

How can we help you?

Try our conversational search powered by Generative AI!

AI OnAI Off

Install the JavaScript (Browser) SDK prior to v6

The steps necessary to install the Optimizely Feature Experimentation JavaScript (Browser) SDK into your application.

The JavaScript (Browser) SDK can be used in a browser and is distributed through npm:

Using npm:

npm install --save @optimizely/optimizely-sdk

Using yarn:

yarn add @optimizely/optimizely-sdk

Using pnpm:

pnpm add @optimizely/optimizely-sdk

Using deno (no installation required):

import optimizely from "npm:@optimizely/optimizely-sdk"

The full JavaScript SDK source code is on GitHub.

Requirements

The JavaScript (Browser) SDK requires a modern web browser that is ES5-compliant.

The following peer dependencies may be required for use in production:

{ "json-schema@0.4.0": { "licenses": [ "AFLv2.1", "BSD" ], "publisher": "Kris Zyp", "repository": "<https://github.com/kriszyp/json-schema>" }, "murmurhash@2.0.1": { "licenses": "MIT\*", "repository": "<https://github.com/perezd/node-murmurhash>" }, "uuid@8.3.2": { "licenses": "MIT", "repository": "<https://github.com/kelektiv/node-uuid>" }, "decompress-response@4.2.1": { "licenses": "MIT", "repository": "<https://github.com/sindresorhus/decompress-response>" } }

To regenerate this, run the following command:

npx license-checker --production --json | jq 'map_values({ licenses, publisher, repository }) | del(.[][] | nulls)'

and remove the self (@optimizely/optimizely-sdk) entry.

📘

Note

The jq command-line JSON processor is required to run the above script. You may install jq to your environment by using Homebrew on MacOS using the command brew install jq. For Windows users, please visit the jq GitHub repository to learn more.

Next

After installing, you need to initialize the SDK.


Did this page help you?