{"id":18300378,"url":"https://github.com/jpdevries/optimizely-sdk","last_synced_at":"2025-04-09T09:27:06.839Z","repository":{"id":43418582,"uuid":"223208014","full_name":"jpdevries/optimizely-sdk","owner":"jpdevries","description":"Forking to run perf tests on @optimizely/optimizely-sdk","archived":false,"fork":false,"pushed_at":"2023-01-06T08:13:50.000Z","size":1155,"stargazers_count":0,"open_issues_count":11,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-15T03:32:52.101Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jpdevries.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.MD","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-11-21T15:43:08.000Z","updated_at":"2019-11-21T15:47:49.000Z","dependencies_parsed_at":"2023-02-05T16:45:54.643Z","dependency_job_id":null,"html_url":"https://github.com/jpdevries/optimizely-sdk","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpdevries%2Foptimizely-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpdevries%2Foptimizely-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpdevries%2Foptimizely-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpdevries%2Foptimizely-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jpdevries","download_url":"https://codeload.github.com/jpdevries/optimizely-sdk/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248010692,"owners_count":21032966,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-05T15:12:09.577Z","updated_at":"2025-04-09T09:27:06.817Z","avatar_url":"https://github.com/jpdevries.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JavaScript SDK for Optimizely X Full Stack\n[![npm](https://img.shields.io/npm/v/%40optimizely%2Foptimizely-sdk.svg)](https://www.npmjs.com/package/@optimizely/optimizely-sdk)\n[![npm](https://img.shields.io/npm/dm/%40optimizely%2Foptimizely-sdk.svg)](https://www.npmjs.com/package/@optimizely/optimizely-sdk)\n[![Travis CI](https://img.shields.io/travis/optimizely/javascript-sdk.svg)](https://travis-ci.org/optimizely/javascript-sdk)\n[![Coveralls](https://img.shields.io/coveralls/optimizely/javascript-sdk.svg)](https://coveralls.io/github/optimizely/javascript-sdk)\n[![license](https://img.shields.io/github/license/optimizely/javascript-sdk.svg)](https://choosealicense.com/licenses/apache-2.0/)\n\n\nOptimizely X Full Stack is A/B testing and feature management for product development teams. Experiment in any application. Make every feature on your roadmap an opportunity to learn. Learn more at the [landing page](https://www.optimizely.com/products/full-stack/), or see the [documentation](https://docs.developers.optimizely.com/full-stack/docs).\n\nThis directory contains the source code for the JavaScript SDK, which is usable in Node.js, browsers, and beyond.\n\n## Getting Started\n\n### Prerequisites\n\nEnsure the SDK supports all of the platforms you're targeting. In particular, the SDK targets any ES5-compliant JavaScript environment. We officially support:\n- Node.js \u003e= 4.0.0. By extension, environments like AWS Lambda, Google Cloud Functions, and Auth0 Webtasks are supported as well. Older Node.js releases likely work too (try `npm test` to validate for yourself), but are not formally supported.\n- [Web browsers](https://caniuse.com/#feat=es5)\n\nOther environments likely are compatible, too, but note that we don't officially support them:\n- Progressive Web Apps, WebViews, and hybrid mobile apps like those built with React Native and Apache Cordova.\n- [Cloudflare Workers](https://developers.cloudflare.com/workers/) and [Fly](https://fly.io/), both of which are powered by recent releases of V8.\n- Anywhere else you can think of that might embed a JavaScript engine. The sky is the limit; experiment everywhere! 🚀\n\nOnce you've validated that the SDK supports the platforms you're targeting, fetch the package from [NPM](https://www.npmjs.com/package/@optimizely/optimizely-sdk). Using `npm`:\n\n```\nnpm install --save @optimizely/optimizely-sdk\n```\n\n### Usage\nSee the Optimizely X Full Stack [developer documentation](http://developers.optimizely.com/server/reference/index.html) to learn how to set up your first JavaScript project and use the SDK.\n\nThe package's entry point is a CommonJS module, which can be used directly in environments which support it (e.g., Node.js, or loaded in a browser via Browserify or RequireJS). Additionally, you can include a standalone bundle of the SDK in your web page by fetching it from [unpkg](https://unpkg.com/):\n\n```html\n\u003cscript src=\"https://unpkg.com/@optimizely/optimizely-sdk/dist/optimizely.browser.umd.min.js\"\u003e\u003c/script\u003e\n\n\u003c!-- You can also use the unminified version if necessary --\u003e\n\u003cscript src=\"https://unpkg.com/@optimizely/optimizely-sdk/dist/optimizely.browser.umd.js\"\u003e\u003c/script\u003e\n```\n\nWhen evaluated, that bundle assigns the SDK's exports to `window.optimizelySdk`. If you wish to use the asset locally (for example, if unpkg is down), you can find it in your local copy of the package at dist/optimizely.browser.umd.min.js.\n\nRegarding `EventDispatcher`s: In Node.js and browser environments, the default `EventDispatcher` is powered by the [`http/s`](https://nodejs.org/api/http.html) modules and by [`XMLHttpRequest`](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#Browser_compatibility), respectively. In all other environments, you must supply your own `EventDispatcher`.\n\n### Migrating from 1.x.x\n\nThis version represents a major version change and, as such, introduces some breaking changes:\n\n- The Node.js SDK is now combined with the JavaScript SDK. We now have just one package, `@optimizely/optimizely-sdk`, that works in many JavaScript environments.\n\n- We no longer support Node.js \u003c 4.0.0, which collectively [reached end-of-life](https://github.com/nodejs/Release#end-of-life-releases) on 2016-12-31.\n\n- You will no longer be able to pass in `revenue` value as a stand-alone argument to the `track` call. Instead you will need to pass it as an entry in the [`eventTags`](https://developers.optimizely.com/x/solutions/sdks/reference/index.html?language=javascript#event-tags).\n\n### Feature Management access\n\nTo access Feature Management in the Optimizely web application, please contact your Optimizely account executive.\n\n## Contributing\nThis information is relevant only if you plan on contributing to the SDK itself.\n\n```sh\n# Prerequisite: Install dependencies.\nnpm install\n\n# Run unit tests with mocha.\nnpm test\n\n# Run unit tests in many browsers, currently via BrowserStack.\n# For this to work, the following environment variables must be set:\n#   - BROWSER_STACK_USERNAME\n#   - BROWSER_STACK_PASSWORD\nnpm run test-xbrowser\n```\n\n[.travis.yml](/.travis.yml) contains the definitions for `BROWSER_STACK_USERNAME` and `BROWSER_STACK_ACCESS_KEY` used in CI. These values are Optimizely's BrowserStack credentials, encrypted with our Travis CI public key. These creds can be rotated by following [these docs](https://docs.travis-ci.com/user/environment-variables/#Defining-encrypted-variables-in-.travis.yml).\n\n## Credits\n\nFirst-party code (under lib/) is copyright Optimizely, Inc. and contributors, licensed under Apache 2.0.\n\n## Additional Code\n\nProd dependencies are as follows:\n\n```json\n{\n  \"json-schema@0.2.3\": {\n    \"licenses\": [\n      \"AFLv2.1\",\n      \"BSD\"\n    ],\n    \"publisher\": \"Kris Zyp\",\n    \"repository\": \"https://github.com/kriszyp/json-schema\"\n  },\n  \"lodash@4.17.10\": {\n    \"licenses\": \"MIT\",\n    \"publisher\": \"John-David Dalton\",\n    \"repository\": \"https://github.com/lodash/lodash\"\n  },\n  \"murmurhash@0.0.2\": {\n    \"licenses\": \"MIT*\",\n    \"repository\": \"https://github.com/perezd/node-murmurhash\"\n  },\n  \"sprintf@0.1.5\": {\n    \"licenses\": \"BSD-3-Clause\",\n    \"publisher\": \"Moritz Peters\",\n    \"repository\": \"https://github.com/maritz/node-sprintf\"\n  },\n  \"uuid@3.2.1\": {\n    \"licenses\": \"MIT\",\n    \"repository\": \"https://github.com/kelektiv/node-uuid\"\n  }\n}\n```\n\nTo regenerate this, run the following command:\n\n```sh\nnpx license-checker --production --json | jq 'map_values({ licenses, publisher, repository }) | del(.[][] | nulls)'\n```\n\nand remove the self (`@optimizely/optimizely-sdk`) entry.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpdevries%2Foptimizely-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjpdevries%2Foptimizely-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpdevries%2Foptimizely-sdk/lists"}