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

Package detail

vwo-fme-node-sdk

wingify8kApache-2.01.19.0TypeScript support: included

VWO Node/JavaScript SDK for Feature Management and Experimentation

readme

VWO Feature Management and Experimentation SDK for Node.js and JavaScript(Browser)

npm version License

CI codecov

Overview

The VWO Feature Management and Experimentation SDK (VWO FME Node SDK) enables Node.js and JavaScript developers to integrate feature flagging and experimentation into their applications. This SDK provides full control over feature rollout, A/B testing, and event tracking, allowing teams to manage features dynamically and gain insights into user behavior.

Requirements

  • Node.js v12 or later

Installation

Install the SDK via npm or yarn:

# via npm
npm install vwo-fme-node-sdk --save

# via yarn
yarn add vwo-fme-node-sdk

Basic Usage Example

The following example demonstrates initializing the SDK with a VWO account ID and SDK key, setting a user context, checking if a feature flag is enabled, and tracking a custom event.

const { init } = require('vwo-fme-node-sdk');

// Initialize VWO client
(async function () {
  const vwoClient = await init({
    accountId: '123456',
    sdkKey: '32-alpha-numeric-sdk-key',
  });

  // Check if feature is enabled for user
  const userContext = { id: 'unique_user_id' };
  const feature = await vwoClient.getFlag('feature_key', userContext);

  if (feature.isEnabled()) {
    console.log('Feature is enabled!');

    // Get feature variable
    const value = feature.getVariable('feature_variable', 'default_value');
    console.log('Variable value:', value);
  }

  // Track an event
  vwoClient.trackEvent('event_name', userContext);
})();

The SDK includes TypeScript type definitions for better type safety and IDE support. Here's how to use the SDK with TypeScript:

import { 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);

Advanced Configuration Options

To customize the SDK further, additional parameters can be passed to the init() API. Here's a table describing each option:

Parameter Description Required Type Example
accountId VWO Account ID for authentication. Yes String '123456'
sdkKey SDK key corresponding to the specific environment to initialize the VWO SDK Client. You can get this key from VWO Application. Yes String '32-alpha-numeric-sdk-key'
pollInterval Time interval for fetching updates from VWO servers (in milliseconds). No Number 60000
gatewayService An object representing configuration for integrating VWO Gateway Service. No Object see Gateway section
storage Custom storage connector for persisting user decisions and campaign data. No Object See Storage section
clientStorage Browser storage configuration for persisting user data in browser environments. No Object See Client Storage section
logger Toggle log levels for more insights or for debugging purposes. You can also customize your own transport in order to have better control over log messages. No Object See Logger section
shouldWaitForTrackingCalls Ensures tracking calls complete before resolving promises, useful for edge computing environments like Cloudflare Workers No Boolean true
integrations A callback function that receives data which can be pushed to any external tool that you need to integrate with. No Object See Integrations
batchEventData Configuration for batch event processing to optimize network requests No Object See Batch Events section

Refer to the official VWO documentation for additional parameter details.

User Context

The context object uniquely identifies users and is crucial for consistent feature rollouts. A typical context includes an id for identifying the user. It can also include other attributes that can be used for targeting and segmentation, such as customVariables, userAgent and ipAddress.

Parameters Table

The following table explains all the parameters in the context object:

Parameter Description Required Type Example
id Unique identifier for the user. Yes String 'unique_user_id'
customVariables Custom attributes for targeting. No Object { age: 25, location: 'US' }
userAgent User agent string for identifying the user's browser and operating system. No String 'Mozilla/5.0 ... Safari/537.36'
ipAddress IP address of the user. No String '1.1.1.1'

Example

const userContext = {
  id: 'unique_user_id',
  customVariables: { age: 25, location: 'US' },
  userAgent:
    'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36',
  ipAddress: '1.1.1.1',
};

Basic Feature Flagging

Feature Flags serve as the foundation for all testing, personalization, and rollout rules within FME. To implement a feature flag, first use the getFlag API to retrieve the flag configuration. The getFlag API provides a simple way to check if a feature is enabled for a specific user and access its variables. It returns a feature flag object that contains methods for checking the feature's status and retrieving any associated variables.

Parameter Description Required Type Example
featureKey Unique identifier of the feature flag Yes String 'new_checkout'
context Object containing user identification and contextual information Yes Object { id: 'user_123' }

Example usage:

const featureFlag = await vwoClient.getFlag('feature_key', { id: 'unique_user_id' });
const isEnabled = featureFlag.isEnabled();

if (isEnabled) {
  console.log('Feature is enabled!');

  // Get and use feature variable with type safety
  const variableValue = featureFlag.getVariable('feature_variable', 'default_value');
  console.log('Variable value:', variableValue);
} else {
  console.log('Feature is not enabled!');
}

Custom Event Tracking

Feature flags can be enhanced with connected metrics to track key performance indicators (KPIs) for your features. These metrics help measure the effectiveness of your testing rules by comparing control versus variation performance, and evaluate the impact of personalization and rollout campaigns. Use the trackEvent API to track custom events like conversions, user interactions, and other important metrics:

Parameter Description Required Type Example
eventName Name of the event you want to track Yes String 'purchase_completed'
context Object containing user identification and other contextual information Yes Object { id: 'user_123' }
eventProperties Additional properties/metadata associated with the event No Object { amount: 49.99 }

Example usage:

vwoClient.trackEvent('event_name', { id: 'unique_user_id' }, { amount: 49.99 });

See Tracking Conversions documentation for more information.

Pushing Attributes

User attributes provide rich contextual information about users, enabling powerful personalization. The setAttribute method provides a simple way to associate these attributes with users in VWO for advanced segmentation. Here's what you need to know about the method parameters:

Parameter Description Required Type Example
attributeKey The unique identifier/name of the attribute you want to set Yes String 'plan_type'
attributeValue The value to be assigned to the attribute Yes Any 'premium', 25, etc.
context Object containing user identification and other contextual information Yes Object { id: 'user_123' }

Example usage:

vwoClient.setAttribute('attribute_name', 'attribute_value', { id: 'unique_user_id' });

See Pushing Attributes documentation for additional information.

Polling Interval Adjustment

The pollInterval is an optional parameter that allows the SDK to automatically fetch and update settings from the VWO server at specified intervals. Setting this parameter ensures your application always uses the latest configuration.

const vwoClient = await init({
  accountId: '123456',
  sdkKey: '32-alpha-numeric-sdk-key',
  pollInterval: 60000,
});

Gateway

The VWO FME Gateway Service is an optional but powerful component that enhances VWO's Feature Management and Experimentation (FME) SDKs. It acts as a critical intermediary for pre-segmentation capabilities based on user location and user agent (UA). By deploying this service within your infrastructure, you benefit from minimal latency and strengthened security for all FME operations.

Why Use a Gateway?

The Gateway Service is required in the following scenarios:

  • When using pre-segmentation features based on user location or user agent.
  • For applications requiring advanced targeting capabilities.
  • It's mandatory when using any thin-client SDK (e.g., Go).

How to Use the Gateway

The gateway can be customized by passing the gatewayService parameter in the init configuration.

const vwoClient = await init({
  accountId: '123456',
  sdkKey: '32-alpha-numeric-sdk-key',
  gatewayService: {
    url: 'https://custom.gateway.com',
  },
});

Refer to the Gateway Documentation for further details.

Storage

The SDK operates in a stateless mode by default, meaning each getFlag call triggers a fresh evaluation of the flag against the current user context.

To optimize performance and maintain consistency, you can implement a custom storage mechanism by passing a storage parameter during initialization. This allows you to persist feature flag decisions in your preferred database system (like Redis, MongoDB, or any other data store).

Key benefits of implementing storage:

  • Improved performance by caching decisions
  • Consistent user experience across sessions
  • Reduced load on your application

The storage mechanism ensures that once a decision is made for a user, it remains consistent even if campaign settings are modified in the VWO Application. This is particularly useful for maintaining a stable user experience during A/B tests and feature rollouts.

class StorageConnector extends StorageConnector {
  constructor() {
    super();
  }

  /**
   * Get data from storage
   * @param {string} featureKey
   * @param {string} userId
   * @returns {Promise<Object>}
   */
  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
  }
}

const vwoClient = await init({
  accountId: '123456',
  sdkKey: '32-alpha-numeric-sdk-key',
  storage: StorageConnector,
});

Client Storage

In browser environments, the SDK automatically uses localStorage to persist user data. You can customize this behavior using the clientStorage option:

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
    disabled: false, // defaults to false, set to true to disable storage
  },
});
Parameter Description Required Type Default
key Key used to store data in browser storage No String 'vwo_fme_data'
provider Storage provider (localStorage or sessionStorage) No Object localStorage
disabled Disable browser storage completely No Boolean false

Note: This feature is only applicable in browser environments. In Node.js environments, you should continue using the storage option for custom storage implementations.

Logger

VWO by default logs all ERROR level messages to your server console. To gain more control over VWO's logging behaviour, you can use the logger parameter in the init configuration.

Parameter Description Required Type Example
level Log level to control verbosity of logs Yes String DEBUG
prefix Custom prefix for log messages No String 'CUSTOM LOG PREFIX'
transport Custom logger implementation No Object See example below

Example 1: Set log level to control verbosity of logs

const vwoClient1 = await init({
  accountId: '123456',
  sdkKey: '32-alpha-numeric-sdk-key',
  logger: {
    level: 'DEBUG',
  },
});

Example 2: Add custom prefix to log messages for easier identification

const vwoClient2 = await init({
  accountId: '123456',
  sdkKey: '32-alpha-numeric-sdk-key',
  logger: {
    level: 'DEBUG',
    prefix: 'CUSTOM LOG PREFIX',
  },
});

Example 3: Implement custom transport to handle logs your way

The transport parameter allows you to implement custom logging behavior by providing your own logging functions. You can define handlers for different log levels (debug, info, warn, error, trace) to process log messages according to your needs.

For example, you could:

  • Send logs to a third-party logging service
  • Write logs to a file
  • Format log messages differently
  • Filter or transform log messages
  • Route different log levels to different destinations

The transport object should implement handlers for the log levels you want to customize. Each handler receives the log message as a parameter.

const vwoClient3 = await init({
  accountId: '123456',
  sdkKey: '32-alpha-numeric-sdk-key',
  logger: {
    transport: {
      level: 'INFO',
      log: (level, message) => {
        // your custom implementation here
      },
    },
  },
});

For multiple transports you can use the transports parameter. For example:

const vwoClient3 = await init({
  accountId: '123456',
  sdkKey: '32-alpha-numeric-sdk-key',
  logger: {
    transports: [
      {
        level: 'INFO',
        log: (level, message) => {
          // your custom implementation here
        },
      },
      {
        level: 'ERROR',
        log: (level, message) => {
          // your custom implementation here
        },
      },
    ],
  },
});

Integrations

VWO FME SDKs provide seamless integration with third-party tools like analytics platforms, monitoring services, customer data platforms (CDPs), and messaging systems. This is achieved through a simple yet powerful callback mechanism that receives VWO-specific properties and can forward them to any third-party tool of your choice.

const vwoClient = await vwo.init({
  sdkKey: '32-alpha-numeric-sdk-key', //replace with the SDK key for your environment
  accountId: '123456', //replace with your VWO account ID
  integrations: {
    callback(properties) {
      // your custom implementation here
    },
  },
});

Wait for Tracking Calls

The shouldWaitForTrackingCalls is an optional parameter that allows you to control whether the SDK should wait for tracking calls to complete before resolving promises. When enabled, tracking API calls will wait for the server response before resolving.

This is particularly useful for edge computing environments like Cloudflare Workers, where it ensures that tracking calls complete before resolving the promise.

const vwoClient = await init({
  accountId: '123456',
  sdkKey: '32-alpha-numeric-sdk-key',
  shouldWaitForTrackingCalls: true,
});

Batch Events

The batchEventData configuration allows you to optimize network requests by batching multiple events together. This is particularly useful for high-traffic applications where you want to reduce the number of API calls.

Parameter Description Required Type Default
requestTimeInterval Time interval (in seconds) after which events are flushed to the server No Number 600
eventsPerRequest Maximum number of events to batch together before sending to the server No Number 100
flushCallback Callback function to be executed after events are flushed No Function See example

Example usage:

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();

Version History

The version history tracks changes, improvements, and bug fixes in each version. For a full history, see the CHANGELOG.md.

Development and Testing

Install Dependencies and Bootstrap Git Hooks

yarn install

Compile TypeScript to JavaScript

yarn build

Run Tests

# production tests
yarn run test:prod

# development tests
yarn run test:dev

Contributing

We welcome contributions to improve this SDK! Please read our contributing guidelines before submitting a PR.

Code of Conduct

Our Code of Conduct outlines expectations for all contributors and maintainers.

License

Apache License, Version 2.0

Copyright 2024-2025 Wingify Software Pvt. Ltd.

changelog

Changelog

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.

[1.19.0] - 2025-05-29

Added

  • Enhanced browser environment support by enabling direct communication with VWO's DACDN when no VWO Gateway Service is 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 localStorage to ensure consistent user experiences across sessions and optimize performance by avoiding re-evaluating users. You can customize or disable this behavior using the clientStorage option 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
      },
    });

[1.18.0] - 2025-05-19

Changed

  • Merged #3 by @thomasdbock
  • Exported interfaces IVWOClient, IVWOOptions, IVWOContextModel, and Flag to provide better TypeScript support and enable type checking for SDK configuration and usage

    import { 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);

[1.17.1] - 2025-05-13

Added

  • 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.

[1.17.0] - 2025-05-06

Added

  • Added support for batchEventData configuration to optimize network requests by batching multiple events together. This allows you to:

    • Configure requestTimeInterval to flush events after a specified time interval
    • Set eventsPerRequest to control maximum events per batch
    • Implement flushCallback to 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();

[1.16.0] - 2025-05-01

Fixed

  • Fixed schema validation error that occurred when no feature flags were configured in the VWO application by properly handling empty features and campaigns from settings response

[1.15.0] - 2025-04-18

Added

  • Added exponential backoff retry mechanism for failed network requests. This improves reliability by automatically retrying failed requests with increasing delays between attempts.

[1.14.1] - 2025-03-13

Fixed

  • Fixed the issue where the SDK was not sending error logs to VWO server for better debugging.

[1.14.0] - 2025-03-12

Added

  • Added support for sending error logs to VWO server for better debugging.

[1.13.0] - 2025-02-21

Fixed

  • Fixed network request handling in serverless environments by replacing XMLHttpRequest with fetch API for improved compatibility and reliability.

[1.12.0] - 2024-02-13

Added

  • Support for Object in setAttribute method to send multiple attributes at once.

    const attributes = { attr1: value1, attr2: value2 };
    client.setAttribute(attributes, context);

[1.11.0] - 2024-12-20

Added

  • 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.

[1.10.0] - 2024-11-22

Added

  • added new method updateSettings to update settings on the client instance.

[1.9.0] - 2024-11-14

Added

  • Added support to pass settings in init method.

[1.8.0] - 2024-09-25

Added

  • added support for Personalise rules within Mutually Exclusive Groups.

[1.7.0] - 2024-09-03

Added

  • 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
    });

[1.6.0] - 2024-08-27

Fixed

  • Update key name from user to userId for 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
      }
    }

[1.5.2] - 2024-08-20

Fixed

  • Updated regular expressions for GREATER_THAN_MATCH, GREATER_THAN_EQUAL_TO_MATCH, LESS_THAN_MATCH, and LESS_THAN_EQUAL_TO_MATCH segmentation operators

[1.5.1] - 2024-08-13

Fixed

  • Encode user-agent in setAttribute and trackEvent APIs before making a call to VWO server`

[1.5.0] - 2024-08-01

Changed

  • 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

Added

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

[1.3.1] - 2024-07-225

Fixed

  • fix: add support for DSL where featureIdValue could be off
  • refactor: make eventProperties as third parameter

[1.3.0] - 2024-06-20

Fixed

  • Update dist folder

[1.2.4] - 2024-06-14

Fixed

  • Fix: add revenueProp in metricSchema for settings validation
  • Optimizaton: if userAgent and ipAddress both are null, then no need to send call to gatewayService

[1.2.2] - 2024-06-05

Fixed

[1.2.1] - 2024-05-30

Fixed

  • 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

Changed

  • Instead of hardcoding the test-cases and expectations for getFlag API, 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

[1.2.0] - 2024-05-22

Changed

  • Segmentation module

    • Modify how context and settings are being used inside modular segmentor code
    • Cache location / User-Agent data per getFlag API
    • 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 getFlag API
  • 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
    });

Added

  • 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
  • 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
    });

[1.0.0] - 2024-02-22

Added

  • 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);