@optimizely/optimizely-sdk
Advanced tools
Changelog
[3.2.0] - May 30th, 2019
Added support for automatic datafile management (#261), (#266), (#267), (#268), (#270), (#272)
sdkKey
as a string property in the options object you pass to createInstance
.onReady
method to wait until the download is complete and the SDK is ready to use.datafileOptions
object within the options you pass to createInstance
.
autoUpdate: true
. Periodically (on the provided update interval), the SDK instance will download the datafile and update itself. Use this to ensure that the SDK instance is using a fresh datafile reflecting changes recently made to your experiment or feature configuration.OPTIMIZELY_CONFIG_UPDATE
notification type to be notified when an instance updates its Optimizely config after obtaining a new datafile.close
methodconst optimizely = require('@optimizely/optimizely-sdk');
const optimizelyClientInstance = optimizely.createInstance({
sdkKey: '12345', // Provide the sdkKey of your desired environment here
});
onReady
to wait until optimizelyClientInstance has a datafileconst optimizely = require('@optimizely/optimizely-sdk');
const optimizelyClientInstance = optimizely.createInstance({
sdkKey: '12345',
});
optimizelyClientInstance.onReady().then(() => {
// optimizelyClientInstance is ready to use, with datafile downloaded from the Optimizely CDN
});
const optimizely = require('@optimizely/optimizely-sdk');
const optimizelyClientInstance = optimizely.createInstance({
sdkKey: '12345',
datafileOptions: {
autoUpdate: true,
updateInterval: 600000, // 10 minutes in milliseconds
},
});
optimizelyClientInstance.notificationCenter.addNotificationListener(
optimizely.enums.NOTIFICATION_TYPES.OPTIMIZELY_CONFIG_UPDATE,
() => {
// optimizelyClientInstance has updated its Optimizely config
}
);
// Stop automatic updates - optimizelyClientInstance will use whatever datafile it currently has from now on
optimizelyClientInstance.close();
onReady
, close
) and new properties on object accepted by createInstance (datafileOptions
, sdkKey
), (#263), (#278)clientEngine
(#279)optimizely.track()
(#281)Changelog
[3.2.0-beta] - May 16th, 2019
onReady
, close
) and new properties on object accepted by createInstance (datafileOptions
, sdkKey
)Changelog
[3.2.0-alpha] - April 26nd, 2019
sdkKey
as a string property in the options object you pass to createInstance
.onReady
method to wait until the download is complete and the SDK is ready to use.datafileOptions
object within the options you pass to createInstance
.
autoUpdate: true
. Periodically (on the provided update interval), the SDK instance will download the datafile and update itself. Use this to ensure that the SDK instance is using a fresh datafile reflecting changes recently made to your experiment or feature configuration.OPTIMIZELY_CONFIG_UPDATE
notification type to be notified when an instance updates its Optimizely config after obtaining a new datafile.close
methodconst optimizely = require('@optimizely/optimizely-sdk');
const optimizelyClientInstance = optimizely.createInstance({
sdkKey: '12345', // Provide the sdkKey of your desired environment here
});
onReady
to wait until optimizelyClientInstance has a datafileconst optimizely = require('@optimizely/optimizely-sdk');
const optimizelyClientInstance = optimizely.createInstance({
sdkKey: '12345',
});
optimizelyClientInstance.onReady().then(() => {
// optimizelyClientInstance is ready to use, with datafile downloaded from the Optimizely CDN
});
const optimizely = require('@optimizely/optimizely-sdk');
const optimizelyClientInstance = optimizely.createInstance({
sdkKey: '12345',
datafileOptions: {
autoUpdate: true,
updateInterval: 600000, // 10 minutes in milliseconds
},
});
optimizelyClientInstance.notificationCenter.addNotificationListener(
optimizely.enums.NOTIFICATION_TYPES.OPTIMIZELY_CONFIG_UPDATE,
() => {
// optimizelyClientInstance has updated its Optimizely config
}
);
// Stop automatic updates - optimizelyClientInstance will use whatever datafile it currently has from now on
optimizelyClientInstance.close();
Changelog
[3.1.0] - April 22nd, 2019
logger
and logLevel
on the optimizelySDK singleton (#232)logger
and logLevel
are now set globally for all instances of Optimizely. If you were passing
different loggers to individual instances of Optimizely, logging behavior may now be different.var optimizelySDK = require('@optimizely/optimizely-sdk');
// logger and logLevel are now set on the optimizelySDK singleton
optimizelySDK.setLogger(optimizelySDK.logging.createLogger());
// valid levels: 'DEBUG', 'INFO', 'WARN', 'ERROR'
optimizelySDK.setLogLevel('WARN');
// enums can also be used
optimizelySDK.setLogLevel(optimizelySDK.enums.LOG_LEVEL.ERROR);
var optimizelySDK = require('@optimizely/optimizely-sdk');
optimizelySDK.setLogger(null);
Changelog
[3.1.0-beta1] - March 5th, 2019
logger
and logLevel
on the optimizelySDK singleton (#232)logger
and logLevel
are now set globally for all instances of Optimizely. If you were passing
different loggers to individual instances of Optimizely, logging behavior may now be different.var optimizelySDK = require('@optimizely/optimizely-sdk');
// logger and logLevel are now set on the optimizelySDK singleton
optimizelySDK.setLogger(optimizelySDK.logging.createLogger());
// valid levels: 'DEBUG', 'INFO', 'WARN', 'ERROR'
optimizelySDK.setLogLevel('WARN');
// enums can also be used
optimizelySDK.setLogLevel(optimizely.enums.LOG_LEVEL.ERROR);
var optimizelySDK = require('@optimizely/optimizely-sdk');
optimizelySDK.setLogger(null);
Changelog
[3.0.1] - February 21, 2019
loggers
, errorHandlers
, eventDispatcher
and enums
on top level require.createLogger
and createNoOpLogger
are available as methods on optimizelySdk.logging
optimizelySdk.errorHandler
optimizelySdk.eventDispatcher
optimizelySdk.enums
Changelog
[3.0.0] - February 13, 2019
The 3.0 release improves event tracking and supports additional audience targeting functionality.
track
method now dispatches its conversion event unconditionally, without first determining whether the user is targeted by a known experiment that uses the event. This may increase outbound network traffic.exists
matcher that passes if the user has a non-null value for the targeted user attribute and fails otherwise.substring
matcher that resolves if the user has a string value for the targeted attribute.gt
(greater than) and lt
(less than) matchers that resolve if the user has a valid number value for the targeted attribute. A valid number is a finite number in the inclusive range [-2⁵³, 2⁵³].exact
) matcher can now be used to target booleans and valid numbers, not just strings."and"
and "not"
operators, not just the "or"
operator (#175)$opt_experiment_bucket_map
attribute to ensure that the user gets a specific variation (#179).window.optimizelyClient
from the bundled build. Now, window.optimizelySdk
can be used instead. (#189).exists
matcher) no longer resolve to false
when they fail to find an legitimate value for the targeted user attribute. The result remains null
(unknown). Therefore, an audience that negates such a condition (using the "not"
operator) can no longer resolve to true
unless there is an unrelated branch in the condition tree that itself resolves to true
.setForcedVariation
now treats an empty variation key as invalid and does not reset the variation (#185).0
as the revenue
or value
for a conversion event when using the track
method. Previously, 0
was withheld and would not appear in your data export (#213).