All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Internal events gating and sampling for
vwo_fmeSdkInit,vwo_sdkUsageStats, andvwo_sdkDebugto reduce internal event volume.
- Impact Analysis flag OFF events: Fixed bug where impact analysis events were not sent when flag evaluation resulted in OFF/disabled state. The issue was
modelFromDictionary(null)throwing a TypeError when no variation exists, preventing batch event dispatch. Now properly handles null by creating emptyVariationModel().
-
Support for Web Testing pre-segmentation: campaign segmentation can use the
campaignVariationoperand. The SDK evaluates it againstcontext.platformVariables.webTestingCampaigns, a map of Web Testing campaign ID → variation ID (plain object or JSON string). The customer must pass this data in the context to enable web testing pre-segmentation. Supported operand values in settings:122(user in campaign),122_2(exact variation),122_!1(in campaign but not variation 1),!122(not in campaign).Example usage:
const context = { id: 'user-123', platformVariables: { // This is an example, replace with actual object webTestingCampaigns: { 123: '4', 456: '1', }, }, }; const flag = await wingifyClient.getFlag('feature-key', context);
- Added user tracking support: sends a
vwo_feTrackUsageevent when user tracking is enabled for the account and no variation-shown impression was dispatched for the evaluation.
This release introduces Wingify as the primary SDK branding and a new npm package namespace, while keeping existing VWO integrations fully supported on vwo-fme-node-sdk.
-
Wingify npm package —
wingify-fme-node-sdk(Node) andwingify-fme-javascript-sdk(browser) are built from the same codebase as the VWO packages. Install the Wingify package for new integrations:npm install wingify-fme-node-sdk
-
Wingify public API — use
init,onInit,IWingifyOptions,IWingifyClient, andIWingifyContextModelas the recommended entry point for new integrations:const { init } = require('wingify-fme-node-sdk'); (async () => { const client = await init({ accountId: '123456', sdkKey: '32-alpha-numeric-sdk-key', logger: { level: 'DEBUG' }, }); const context = { id: 'user-123' }; const flag = await client.getFlag('feature-key', context); console.log(flag.isEnabled(), flag.getVariation()); })();
TypeScript:
import { init, IWingifyOptions, IWingifyClient } from 'wingify-fme-node-sdk';
- The SDK implementation now uses a shared core with build-time brand selection (
vwovswingify). Wingify builds use Wingify-specific hosts (edge.wingify.netfor settings,collect.wingify.netfor events) and log prefix (Wingify-SDK). - No breaking changes for existing
vwo-fme-node-sdkintegrations — public exports, method signatures, server event names, payload keys, and runtime behavior remain compatible with the VWO platform.
Nothing is deprecated on vwo-fme-node-sdk. Existing imports and types continue to work without modification.
For new projects, install wingify-fme-node-sdk instead of vwo-fme-node-sdk. The API surface is equivalent; only package name and exported type names differ:
Existing VWO package (vwo-fme-node-sdk) |
Wingify package (wingify-fme-node-sdk) |
|---|---|
init, onInit |
init, onInit |
IVWOOptions |
IWingifyOptions |
IVWOClient |
IWingifyClient |
IVWOContextModel |
IWingifyContextModel |
LogLevelEnum, StorageConnector, Flag, getUUID |
Same exports (names unchanged) |
Existing code on vwo-fme-node-sdk does not need to change:
const { init } = require('vwo-fme-node-sdk');
(async () => {
const vwoClient = await init({
accountId: '123456',
sdkKey: '32-alpha-numeric-sdk-key',
});
const context = { id: 'user-123', _vwo: { ua: 'Mozilla/5.0...' } };
const flag = await vwoClient.getFlag('feature-key', context);
})();Migration tip (optional, for new Wingify installs only): Change the npm package from vwo-fme-node-sdk to wingify-fme-node-sdk, and replace type names IVWOOptions → IWingifyOptions, IVWOClient → IWingifyClient, and IVWOContextModel → IWingifyContextModel. Method signatures and SDK behavior are unchanged. Legacy options such as vwoBuilder and context fields such as _vwo remain supported on the VWO package.
- Fixed an issue where
collectionPrefixwas incorrectly prepended to event endpoint URLs when a gateway service was configured.
-
Added support for whitelisting based on custom variables via
variationTargetingVariablesin the context. This allows users to be forcefully bucketed into specific variations based on custom evaluating rules, bypassing standard traffic allocation.Example usage:
const vwoClient = await init({ accountId: '123456', sdkKey: '32-alpha-numeric-sdk-key', }); // Force users with 'premium' plan into a specific whitelisted variation const userContext = { id: 'user-123', variationTargetingVariables: { plan: 'premium', }, }; const flag = await vwoClient.getFlag('feature-key', userContext);
-
Added support for
isDevModeinuserContextthat disables event dispatching for that user when enabled in bothuserContextand VWO settings.Example usage:
const vwoClient = await init({ accountId: '123456', sdkKey: '32-alpha-numeric-sdk-key', }); // send isDevMode in userContext const userContext = { id: 'user-123', isDevMode: true, }; // Decisions are returned as normal, but events are not sent to DaCDN const flag = await vwoClient.getFlag('feature-key', userContext); await vwoClient.trackEvent('event-name', userContext, eventProperties);
-
Added a
shutdown()API onVWOClientto support graceful teardown in long-running environments. Callingshutdown()now stops the internal settings polling loop, flushes any pending batched events, clears batch timers, and releases batching resources.Example usage:
const { init } = require('vwo-fme-node-sdk'); (async () => { const vwoClient = await init({ accountId: '123456', sdkKey: '32-alpha-numeric-sdk-key', }); // When your app/process is about to exit: await vwoClient.shutdown(); })();
-
Optimized the batch events queue to enforce
eventsPerRequestas a hard per-dispatch cap, preserve event ordering when retries occur and avoid unnecessary timer wakeups when the queue is empty. -
Improved Node.js HTTPS networking by introducing a configurable HTTPS agent (
httpsAgentConfig) in the network layer, including validation and sensible defaults forkeepAlive,maxSockets,maxFreeSockets, andtimeoutto provide better socket reuse and connection management.Example usage:
const { init } = require('vwo-fme-node-sdk'); (async () => { const vwoClient = await init({ accountId: '123456', sdkKey: '32-alpha-numeric-sdk-key', httpsAgentConfig: { keepAlive: true, // default: true maxSockets: 100, // default: 100, minimum 50 maxFreeSockets: 20, // default: 20, minimum 10 timeout: 60000, // in milliseconds, default: 60000, minimum 30000 }, }); // ...use the client... })();
-
Added support for custom bucketing seed via
bucketingSeedin the context. This allows users to bucket by a shared identifier instead of the individual user ID, ensuring all users within the same group receive the same variation.Example usage:
const vwoClient = await init({ accountId: '123456', sdkKey: '32-alpha-numeric-sdk-key', }); // All employees of company-abc will get the same variation const context = { id: 'employee-123', bucketingSeed: 'company-abc', }; const flag = await vwoClient.getFlag('feature-key', context);
- Introduced
SDKMetaUtilandsdkMetaconfig to allow overriding the default SDK name and version used in events. VWO FE React SDK will consume via it.
-
Enhanced browser tracking implementation: now uses
navigator.sendBeaconby default for sending events, falling back to XHR when needed. This behavior is configurable viabrowserConfig.networkTransportMode('sendBeacon'or'xhr'). -
Added
browserConfigfor browser-specific configuration, includingnetworkTransportModeandclientStorage.browserConfig.clientStorageis preferred over the top-levelclientStorage, with a safe{}fallback when neither is provided.Example usage:
// Default: use sendBeacon in browser (with XHR fallback) const vwoClient = await init({ accountId: '123456', sdkKey: '32-alpha-numeric-sdk-key', // browserConfig.networkTransportMode defaults to 'sendBeacon' }); // Force XHR for all browser tracking requests const vwoClientWithXHR = await init({ accountId: '123456', sdkKey: '32-alpha-numeric-sdk-key', browserConfig: { networkTransportMode: NetworkTransportMode.XHR, }, });
- Added support for holdout groups to exclude users from features based on segmentation and traffic allocation.
-
Added support to use the context
idas the visitor UUID instead of auto-generating one. You can read the visitor UUID from the flag result viaflag.getUUID()(e.g. to pass to the web client).Example usage:
const vwoClient = await init({ accountId: '123456', sdkKey: '32-alpha-numeric-sdk-key', }); // Default: SDK generates a UUID from id and account const contextWithGeneratedUuid = { id: 'user-123' }; const flag1 = await vwoClient.getFlag('feature-key', contextWithGeneratedUuid); // Use your own UUID (e.g. from web client) by disabling UUID generation const contextWithCustomUuid = { id: 'D7E2EAA667909A2DB8A6371FF0975C2A5', // your existing UUID }; const flag2 = await vwoClient.getFlag('feature-key', contextWithCustomUuid); // Get the UUID from the flag result (e.g. to pass to web client) const uuid = flag1.getUUID(); console.log('Visitor UUID:', uuid);
- Exposed
postSegmentationVariablesandsessionIdin theIVWOContextModelTypeScript interface to enable direct access for SDK users.
-
Added session management capabilities to enable integration with VWO's web client testing campaigns. The SDK now automatically generates and manages session IDs to connect server-side feature flag decisions with client-side user sessions.
Example usage:
const vwoClient = await init({ accountId: '123456', sdkKey: '32-alpha-numeric-sdk-key', }); // Session ID is automatically generated if not provided const context = { id: 'user-123' }; const flag = await vwoClient.getFlag('feature-key', context); // Access the session ID to pass to web client for session recording const sessionId = flag.getSessionId(); console.log('Session ID for web client:', sessionId);
You can also explicitly set a session ID to match web client session
const context = { id: 'user-123', sessionId: 1697123456, // Custom session ID matching web client }; const flag = await vwoClient.getFlag('feature-key', context);
This enhancement enables seamless integration between server-side feature flag decisions and client-side session recording, allowing for comprehensive user behavior analysis across both server and client environments.
-
Refactored the SDK to provide support for multiple instances. Previously, the SDK was singleton-based, which caused state to be shared across multiple SDK instances. Now, you can create any number of SDK instances, each with its own isolated utils, services, and associated state.
const { init } = require('vwo-fme-node-sdk'); // Initialize multiple VWO clients with different account IDs and SDK keys (async function () { // First instance for production environment const vwoClientProd = await init({ accountId: '123456', sdkKey: '32-alpha-numeric-sdk-key-prod', }); // Second instance for staging environment const vwoClientStaging = await init({ accountId: '789012', sdkKey: '32-alpha-numeric-sdk-key-staging', }); // Each instance operates independently with its own settings and state const userContext = { id: 'unique_user_id' }; // Use production client const prodFeature = await vwoClientProd.getFlag('feature_key', userContext); console.log('Production feature enabled:', prodFeature.isEnabled()); // Use staging client const stagingFeature = await vwoClientStaging.getFlag('feature_key', userContext); console.log('Staging feature enabled:', stagingFeature.isEnabled()); })();
Each SDK instance maintains its own:
- Settings and configuration
- Services (storage, logger, network layer, etc.)
- Utils and helper functions
- State and cached data
This ensures complete isolation between instances, allowing you to safely use multiple VWO accounts or environments in the same application without any interference.
- Introduced
setSettingsandgetSettingsmethods in theConnectorclass, enabling persistent storage and retrieval of VWO settings through custom storage connectors.
class StorageConnector extends StorageConnector {
protected ttl = 7200000; // 2 hours in milliseconds
protected alwaysUseCachedSettings = false;
constructor() {
super();
}
/**
* Get data from storage
* @param {string} featureKey
* @param {string} userId
* @returns {Promise<any>}
*/
async get(featureKey, userId) {
// return await data (based on featureKey and userId)
}
/**
* Set data in storage
* @param {object} data
*/
async set(data) {
// Set data corresponding to a featureKey and user ID
// Use data.featureKey and data.userId to store the above data for a specific feature and a user
}
/**
* Get settingsData from storage
* @param {number} accountId
* @param {string} sdkKey
* @returns {Promise<ISettingsData>}
*/
async getSettings(accountId, sdkKey) {
// Implement logic to retrieve cached settings based on accountId and sdkKey
// Must return an object with structure: { settings: {...}, timestamp: number }
}
/**
* Set settingsData in storage
* @param {ISettingsData} data
*/
async setSettings(data) {
// Implement logic to store settings data
// Use data.settings.accountId and data.settings.sdkKey to store the above data for a specific accountId and sdkKey
}
}- Fixed parameter types for
Connectorclassgetandsetmethods to ensure correct usage and TypeScript compatibility. - Improved log transport so that console logging consistently respects the configured
shouldLogToStandardOutputif transports are provided.
- Added support for
edgeConfigoption to enable edge/serverless environment optimizations. This configuration should only be passed in serverless environments (e.g., Cloudflare Workers, Vercel, Fastl, etc.). When used in environments like Cloudflare, Vercel, and Fastly,events areflushed usingctx.waitUntil(vwoClient.flushEvents());to ensure proper event tracking after execution completes.
vwoClient = await init({
accountId: '123456',
sdkKey: '32-alpha-numeric-sdk-key',
edgeConfig: {
shouldWaitForTrackingCalls: true,
},
});
// at the end flush all events
await vwoClient.flushEvents();Note: In Cloudflare/Vercel/Fastly environments, use ctx.waitUntil(vwoClient.flushEvents()); to ensure all events flush and data is sent to VWO servers for reporting purposes.
- Asynchronous dispatch of the
sdkInitevent during initialization to further optimize the init method execution time.
- Improved compatibility and dependency handling for modern JavaScript environments and build systems (including ESM and Shopify Hydrogen).
- Enhanced Logging capabilities for
batch-events-v2endpoint.
- Enhanced Logging capabilities at VWO by sending
vwo_sdkDebugevent with additional debug properties.
- Fixed an issue where type definitions were not properly exported in
package.json.
- Resolved issues causing
Range Errorandundefined (setting)during settings polling.
- Exposed
getUUIDmethod that deterministically generates a UUID for a givenuserIdand VWOaccountIdcombination. The generated UUID is used in VWO and remains consistent for the same user-account pair.
const { getUUID } = require('vwo-fme-node-sdk');
// Generate UUID for a user
const userId = 'user-123';
const accountId = '123456';
const uuid = getUUID(userId, accountId);
console.log('Generated UUID:', uuid);
// Output: Generated UUID: CC25A368ADA0542699EAD62489811105- Add support for user aliasing (will work with Gateway Service only)
vwoClient = await init({
accountId: '123456',
sdkKey: '32-alpha-numeric-sdk-key',
gatewayService: {
url: 'http://your-custom-gateway-url',
},
// Required to use Aliasing
isAliasingEnabled: true,
});
vwoClient.setAlias(userContext, 'aliasId');- Update schema validation to enforce required fields while allowing additional dynamic properties without validation failures
- Fix Usage Stats bug and retry minor bug
- Post-segmentation variables are now automatically included as unregistered attributes, enabling post-segmentation without requiring manual setup.
- Added support for built-in targeting conditions, including
browser version,OS version, andIP address, with advanced operator support (greaterThan, lessThan, regex).`
- Fixed conversion of alphanumeric string to numeric values
- Sends usage statistics to VWO servers automatically during SDK initialization
- Enhanced logging capabilities at VWO by adding additional debug information to VWO Error log messages including relevant metadata for better troubleshooting
- Hardcode SDK name and extract version to a separate file to reduce bundle size by avoiding imports of the entire
package.jsonfile. - Update log message showing incorrect retry time interval
- Added ES Module (ESM) build support for projects using
"type": "module"in theirpackage.jsonfile.
- Added support for sending a one-time initialization event to the server to verify correct SDK setup.
- Remove extra logs from the distributable bundle
- Send the SDK name and version in the events and batching call to VWO as query parameters.
- Send the SDK name and version in the settings call to VWO as query parameters.
- Updated regex in
addIsGatewayServiceRequiredFlagmethod to remove unsupported lookbehind and named capture groups, ensuring compatibility with older browsers like Safari 16.3 (SyntaxError: Invalid regular expression: invalid group specifier name).
-
Added support for polling intervals to periodically fetch and update settings:
- If
pollIntervalis set in options (must be >= 1000 milliseconds), that interval will be used - If
pollIntervalis configured in VWO application settings, that will be used - If neither is set, defaults to 10 minute polling interval
Example usage:
vwoClient = await init({ accountId: '123456', sdkKey: '32-alpha-numeric-sdk-key', pollInterval: 60000, // Set the poll interval to 60 seconds, });
- If
- Added support for redirecting all network calls through a custom proxy URL for browser environments. This feature allows users to route all SDK network requests (settings, tracking, etc.) through their own proxy server. This is particularly useful for bypassing ad-blockers that may interfere with VWO's default network requests.
const vwoClient = await init({
sdkKey: 'VWO_SDK_KEY',
accountId: 'VWO_ACCOUNT_ID',
// All network calls will be routed through this URL
proxyUrl: 'https://your-proxy-server.com',
});-
Added configurable retry mechanism for network requests with partial override support. You can now customize retry behavior by passing a
retryConfigin thenetworkoptions:const vwoClient = await init({ accountId: '123456', sdkKey: '32-alpha-numeric-sdk-key', retryConfig: { shouldRetry: true, // Turn retries on/off (default: true) maxRetries: 3, // How many times to retry (default: 3) initialDelay: 2, // First retry after 2 seconds (default: 2) backoffMultiplier: 2, // Double the delay each time (delays: 2s, 4s, 8s) }, });
- Fixed settings fetch failure on Serverless environment by improving network request handling and compatibility
- Enhanced security for browser storage by implementing Base64 encoding for SDK key stored in localStorage.
-
Enhanced storage configuration options for browser environments with new features:
- Added custom
ttl(Time To Live) option to control how long settings remain valid in storage - Added
alwaysUseCachedSettingsoption to always use cached settings regardless of TTL - Default TTL remains 2 hours if not specified
const vwoClient = await init({ accountId: '123456', sdkKey: '32-alpha-numeric-sdk-key', clientStorage: { key: 'vwo_data', // defaults to vwo_fme_settings provider: sessionStorage, // defaults to localStorage isDisabled: false, // defaults to false alwaysUseCachedSettings: true, // defaults to false ttl: 3600000, // 1 hour in milliseconds, defaults to 2 hours }, });
These new options provide more control over how settings are cached and refreshed:
- When
alwaysUseCachedSettingsis true, the SDK will always use cached settings if available, regardless of TTL - Custom
ttlallows you to control how frequently settings are refreshed from the server - Settings are still updated in the background to keep the cache fresh
Read more here
- Added custom
-
Enhanced browser environment support by enabling direct communication with VWO's DACDN when no
VWO Gateway Serviceis configured to reduce network latency and improves performance by eliminating the need for seting up an intermediate service for browser-based environments. -
Added built-in persistent storage functionality for browser environments. The JavaScript SDK automatically stores feature flag decisions in
localStorageto ensure consistent user experiences across sessions and optimize performance by avoiding re-evaluating users. You can customize or disable this behavior using theclientStorageoption while initializing the JavaScript SDK:const vwoClient = await init({ accountId: '123456', sdkKey: '32-alpha-numeric-sdk-key', clientStorage: { key: 'vwo_data', // defaults to vwo_fme_data provider: sessionStorage, // defaults to localStorage isDisabled: false, // defaults to false, set to true to disable storage }, });
-
Merged #3 by @thomasdbock
-
Exported interfaces
IVWOClient,IVWOOptions,IVWOContextModel, andFlagto provide better TypeScript support and enable type checking for SDK configuration and usageimport { init, IVWOClient, IVWOOptions, Flag } from 'vwo-fme-node-sdk'; // Example of using IVWOOptions for type-safe configuration const options: IVWOOptions = { accountId: '123456', sdkKey: '32-alpha-numeric-sdk-key', }; // Example of using IVWOClient for type-safe client usage const vwoClient: IVWOClient = await init(options); // Example of using Flag interface for type-safe flag handling const flag: Flag = await vwoClient.getFlag('feature-key', { id: 'user-123' }); const isEnabled: boolean = flag.isEnabled(); const stringVariable: string = flag.getVariable('variable_key', 'default_value'); const booleanVariable: boolean = flag.getVariable('variable_key', true); const numberVariable: number = flag.getVariable('variable_key', 10);
- Added a feature to track and collect usage statistics related to various SDK features and configurations which can be useful for analytics, and gathering insights into how different features are being utilized by end users.
-
Added support for
batchEventDataconfiguration to optimize network requests by batching multiple events together. This allows you to:- Configure
requestTimeIntervalto flush events after a specified time interval - Set
eventsPerRequestto control maximum events per batch - Implement
flushCallbackto handle batch processing results - Manually trigger event flushing via
flushEvents()method
const vwoClient = await init({ accountId: '123456', sdkKey: '32-alpha-numeric-sdk-key', batchEventData: { requestTimeInterval: 60, // Flush events every 60 seconds eventsPerRequest: 100, // Send up to 100 events per request flushCallback: (error, events) => { console.log('Events flushed successfully'); // custom implementation here }, }, });
- You can also manually flush events using the
flushEvents()method:
vwoClient.flushEvents();
- Configure
- Fixed schema validation error that occurred when no feature flags were configured in the VWO application by properly handling empty
featuresandcampaignsfrom settings response
- Added exponential backoff retry mechanism for failed network requests. This improves reliability by automatically retrying failed requests with increasing delays between attempts.
- Fixed the issue where the SDK was not sending error logs to VWO server for better debugging.
- Added support for sending error logs to VWO server for better debugging.
- Fixed network request handling in serverless environments by replacing
XMLHttpRequestwithfetchAPI for improved compatibility and reliability.
-
Support for
ObjectinsetAttributemethod to send multiple attributes at once.const attributes = { attr1: value1, attr2: value2 }; client.setAttribute(attributes, context);
- added support for custom salt values in campaign rules to ensure consistent user bucketing across different campaigns. This allows multiple campaigns to share the same salt value, resulting in users being assigned to the same variations across those campaigns. Salt for a campaign can be configured inside VWO application only when the campaign is in the draft state.
- added new method
updateSettingsto update settings on the client instance.
- Added support to pass settings in
initmethod.
- added support for Personalise rules within
Mutually Exclusive Groups.
-
added support to wait for network response incase of edge like environment.
const { init } = require('vwo-fme-node-sdk'); const vwoClient = await init({ accountId: '123456', // VWO Account ID sdkKey: '32-alpha-numeric-sdk-key', // SDK Key shouldWaitForTrackingCalls: true, // if running on edge env });
-
Update key name from
usertouserIdfor storing User ID in storage connector.class StorageConnector extends StorageConnector { constructor() { super(); } /** * Get data from storage * @param {string} featureKey * @param {string} userId * @returns {Promise<any>} */ async get(featureKey, userId) { // return await data (based on featureKey and userId) } /** * Set data in storage * @param {object} data */ async set(data) { // Set data corresponding to a featureKey and user ID // Use data.featureKey and data.userId to store the above data for a specific feature and a user } }
- Updated regular expressions for
GREATER_THAN_MATCH,GREATER_THAN_EQUAL_TO_MATCH,LESS_THAN_MATCH, andLESS_THAN_EQUAL_TO_MATCHsegmentation operators
- Encode user-agent in
setAttributeandtrackEventAPIs before making a call to VWO server`
- Modified code to support browser and Node.js environment
- The same SDK can be used in the browser and Node.js environment without any changes in the code from the customer side
- Refactored code to use interfaces and types wherever missing or required
Client-side Javascript SDK
- Used webpack for bundling code
- Separate builds for Node.js and browser using
webpack - SDK is compatible to be run on browser(as a Script, client-side rendering with React ,Ionic framework, etc.)
- Node.js environment can now use one single bundled file too, if required
- fix: add support for DSL where featureIdValue could be
off - refactor: make eventProperties as third parameter
- Update dist folder
- Fix: add revenueProp in metricSchema for settings validation
- Optimizaton: if userAgent and ipAddress both are null, then no need to send call to gatewayService
- Fix: use experiment-key from rule instead of whitelisted object
- Use vwo-fme-sdk-e2e-test-settings-n-cases for importing segmentation tests instead of using hardcoded
- Handle how device was being used by User-Agent parser.
- Refactor VWO Gateway service code to handle non-US accounts
- Fix passing required headers in the network-calls for tracking user details to VWO servers
- Fix some log messages where variables were not getting interpolated correctly
- Instead of hardcoding the test-cases and expectations for
getFlagAPI, we create a separate repo where tests and expectations were written in a JSON format. This is done to make sure we have common and same tests passing across our FME SDKs. Node SDK is using it as dependency - vwo-fme-sdk-e2e-test-settings-n-cases - SDK is now fully supported from Node 12+ versions. We ensured this by running exhaustive unit/E2E tests via GitHub actions for all the Node 12+ versions
- Add a new github-action to generate and publish code documentation generated via
typedoc
-
Segmentation module
- Modify how context and settings are being used inside modular segmentor code
- Cache location / User-Agent data per
getFlagAPI - Single endpoint for location and User-Agent at gateway-service so that at max one call will be required to fetch data from gateway service
-
Context refactoring
-
Context is now flattened out
{ id: 'user-id', // MANDATORY ipAddress: '1.2.3.4', // OPTIONAL - required for user targeting userAgent: '...', // OPTIONAL - required for user targeting // For pre-segmentation in campaigns customVariables: { price: 300 // ... } }
-
-
Storage optimizations
-
Optimized how data is being stored and retrieved
-
Example on how to pass storage
class StorageConnector extends StorageConnector { constructor() { super(); } /** * Get data from storage * @param {string} featureKey * @param {string} userId * @returns {Promise<any>} */ async get(featureKey, userId) { // return await data (based on featureKey and userId) } /** * Set data in storage * @param {object} data */ async set(data) { // Set data corresponding to a featureKey and user ID // Use data.featureKey and data.userId to store the above data for a specific feature and a user } } init({ sdkKey: '...', accountId: '123456', storage: StorageConnector, });
-
-
Using interfaces, types, and model-driven code
- Since we are using TypeScript which helps in the definition types and catching errors while developing.
-
Overall Code refactoring
- Simplified the flow of
getFlagAPI
- Simplified the flow of
-
Log messages
- Separate Repo to have all the logs in one place.
- Log messages were updated
logger: { level: LogLevelEnum.DEBUG, // DEBUG, INFO, ERROR, TRACE< WARN prefix: 'CUSTOM LOG PREFIX', // VWO-SDK default transport: { // Custom Logger debug: msg => console.log(msg), info: msg => console.log(msg), warn: msg => console.log(msg), error: msg => console.log(msg), trace: msg => console.log(msg) } } init({ sdkKey: '...', accountId: '123456', logger: logger });
-
Code inline documentation
- Entire Code was documented as per JavaScript Documentation convention.
-
Unit and E2E Testing
- Set up Test framework using
Jest - Wrote unit and E2E tests to ensure nothing breaks while pushing new code
- Ensure criticla components are working properly on every build
- Integrate with Codecov to show coverage percentage in README
- Post status of tests running on different node versions to Wingify slack channel
- Set up Test framework using
-
onInit hook
init({ sdkKey: '...', accountId: '123456' }); onInit().then(async (vwoClient) => { const feature = await vwoClient.getFlag('feature-key', context); console.log('getFlag is: ', feature.isEnabled()); }).catch(err => { console.log('Error: ', err); });
-
Error handling
- Gracefully handle any kind of error - TypeError, NetworkError, etc.
-
Polling support
- Provide a way to fetch settings periodically and update the instance to use the latest settings
const vwoClient = await init({ sdkKey: '...', accountId: '123456', pollInterval: 5000 // in milliseconds });
-
First release of VWO Feature Management and Experimentation capabilities
const { init } = require('vwo-fme-node-sdk'); const vwoClient = await init({ accountId: '123456', // VWO Account ID sdkKey: '32-alpha-numeric-sdk-key', // SDK Key }); // set user context const userContext = { id: 'unique_user_id' }; // returns a flag object const getFlag = await vwoClient.getFlag('feature_key', userContext); // check if flag is enabled const isFlagEnabled = getFlag.isEnabled(); // get variable const intVar = getFlag.getVariable('int_variable_key'); // track event vwoClient.trackEvent('addToCart', eventProperties, userContext);