Skip to content

cooperreid-optimizely/optimizely-jsclient-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 

Repository files navigation

Optimizely JSClient Manager

A proof-of-concept solution for using Optimizely's Fullstack JavaScript SDK in the browser which handles SDK script loading & datafile fetching. The optlyClientManager provides wrapper functions for all of the Optimizely SDK's core methods.


Enhancements

init

Loads the SDK script and the datafile, returns a Promise. Also dispatches any tracking calls that were called pre-init.

optlyClientManager.init()

user

Set the user's UUID and attributes. These values will automatically be sent to Optimizely when calling all wrapper methods.

optlyClientManager.user('userId', {'tier': 'gold'});

Wrapper Methods

Calling these methods will automatically attach the UUID and attributes set via optlyClientManager.user

track

(This can be called prior to init)

optlyClientManager.track('add_to_cart');

activate & variation

Wrapper functions for Optimizely SDK methods activate and getVariation. The activate and variation method must be called after optlyClientManager has initallized.

optlyClientManager.activate('exp_for_b');
optlyClientManager.variation('exp_for_b');

Example:

optlyClientManager.user('userId', {'tier': 'gold', 'flag': 'B'});
optlyClientManager.track('add_to_cart');
optlyClientManager.init().then(function() {
  // activate and variation can be used here
});

About

Track Fullstack events client side

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published