Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

optimizely-client-sdk

optimizely23.7k1.6.0

JavaScript SDK for Optimizely X Full Stack

optimizely

readme

Optimizely JavaScript SDK

This repository houses the JavaScript SDK for Optimizely X Full Stack.

Getting Started

Installing the SDK

The SDK is available through npm. To install:

npm install optimizely-client-sdk --save

Or to use in a non CommonJS fashion:

  1. Run npm run build
  2. Pull in dist/optimizely.min.js as a <script>
  3. Use as global variable window.optimizelyClient

Using the SDK

See the Optimizely X Full Stack testing developer documentation to learn how to set up your first JavaScript project and use the SDK.

Development

Installing dependencies

npm install

Unit tests

You can run all unit tests with:

npm test

Contributing

Please see CONTRIBUTING.

changelog


1.6.0

  • Bump optimizely-server-sdk to version 1.5.0, which includes:
    • Implemented IP anonymization.
    • Implemented bucketing IDs.
    • Implemented notification listeners.


1.5.1

  • Bump optimizely-server-sdk to version 1.4.2, which includes:
    • Bug fix to filter out undefined values in attributes and event tags
    • Remove a duplicated test


1.5.0

  • Bump optimizely-server-sdk to version 1.4.0, which includes:
    • Add support for numeric metrics.
    • Add getForcedVariation and setForcedVariation methods for client-side variation setting
    • Bug fix for filtering out null attribute and event tag values


1.4.3

  • Default skipJSONValidation to true
  • Bump optimizely-server-sdk to version 1.3.3, which includes:
    • Removed JSON Schema Validator from Optimizely constructor
    • Updated SDK to use new event endpoint
    • Minor bug fixes


1.4.2

  • Minor performance improvements.


1.4.1

  • Switched to karma/browserstack for cross-browser testing
  • Removed es6-promise
  • Bump optimizely-server-sdk to version 1.3.1, which includes:
    • Minor performance improvements.


1.4.0

  • Reduce lodash footprint.
  • Bump optimizely-server-sdk to version 1.3.0, which includes:
    • Introduced user profile service.
    • Minor performance and readibility improvements.


1.3.5

  • Bump optimizely-server-sdk to version 1.2.3, which includes:
    • Switched to json-schema library which has a smaller footprint.
    • Refactored order of bucketing logic.
    • Refactor lodash dependencies.
    • Fixed error on validation for objects with undefined values for attributes.


1.3.4

  • Bump optimizely-server-sdk to version 1.2.2, which includes:
    • Use the 'name' field for tracking event tags instead of 'id'.


1.3.3

  • Include index.js in package.json files to make sure it gets published regardless of node environment.


1.3.2

  • Bump to 1.3.2 to re-publish to npm


1.3.1

  • Bump optimizely-server-sdk to version 1.2.1, which includes:
    • Gracefully handle empty traffic allocation ranges.


1.3.0

  • Bump optimizely-server-sdk to version 1.2.0, which includes:
    • Introduce support for event tags.
    • Add optional eventTags argument to track method signature.
    • Removed optional eventValue argument from track method signature.
    • Removed optional sessionId argument from activate and track method signatures.
    • Allow log level config on createInstance method.


1.2.2

  • Remove .npmignore to consolidate with .gitignore.
  • Add dist and lib directories to "files" in package.json.

1.2.1

  • Fix webpack build error.


1.2.0

  • Bump optimizely-server-sdk to version 1.1.0, which includes:
    • Add optional sessionId argument to activate and track method signatures.
    • Add sessionId and revision to event ticket.
    • Add 'Launched' status where user gets bucketed but event is not sent to Optimizely.


1.1.1

  • Bump to optimizely-server-sdk to version 1.0.1, which includes:
    • Fix bug so conversion event is not sent if user is not bucketed into any experiment.
    • Bump bluebird version from 3.3.5 to 3.4.6.
    • Update event endpoint from p13nlog.dz.optimizely to logx.optimizely.


1.1.0

  • Add global variable name export for use in non-CommonJS environments
  • Remove redundant lodash core dependency to reduce bundle bloat


1.0.0

  • Introduce support for Full Stack projects in Optimizely X with no breaking changes from previous version.
  • Introduce more graceful exception handling in instantiation and core methods.
  • Update whitelisting to take precedence over audience condition evaluation.
  • Fix bug activating/tracking with attributes not in the datafile.


0.1.4

  • Add functionality for New Optimizely endpoint.


0.1.3

  • Add environment detection to event builder so it can distinguish between events sent from node or the browser.


0.1.2

  • Add CORS param to prevent browsers from logging cors errors in the console when dispatching events.


0.1.1

  • Remove percentageIncluded field from JSON schema, which is not needed.


0.1.0

  • Beta release of the Javascript SDK for our Optimizely testing solution