Install SDK
This topic describes the steps necessary to install the Optimizely JavaScript (Node) SDK.
The JavaScript (Node) SDK is distributed through npm:
Using npm:
npm install --save @optimizely/optimizely-sdkUsing yarn:
yarn add @optimizely/optimizely-sdkUsing pnpm:
pnpm add @optimizely/optimizely-sdkUsing deno (no installation required):
import optimizely from "npm:@optimizely/optimizely-sdk"The full JavaScript SDK source code is on GitHub.
Requirements
The JavaScript (Node) SDK requires Node version 8.0+.
The following peer dependencies may be required for use in production:
{
"[email protected]": {
"licenses": [
"AFLv2.1",
"BSD"
],
"publisher": "Kris Zyp",
"repository": "<https://github.com/kriszyp/json-schema>"
},
"[email protected]": {
"licenses": "MIT\*",
"repository": "<https://github.com/perezd/node-murmurhash>"
},
"[email protected]": {
"licenses": "MIT",
"repository": "<https://github.com/kelektiv/node-uuid>"
},
"[email protected]": {
"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.
NoteThe
jqcommand-line JSON processor is required to run the above script. You may installjqto your environment by using Homebrew on MacOS using the commandbrew install jq. For Windows users, please visit the jq GitHub repository to learn more.
Next
After installing, you need to initialize the SDK.
Updated about 2 months ago