The VWO Feature Management and Experimentation SDK (vwo-fme-node-sdk) provides robust capabilities for integrating feature flagging and experimentation directly into Node.js and browser-based JavaScript applications. Currently stable at version 1.41.0, the library receives consistent updates, indicated by frequent minor and patch releases. It allows developers to dynamically manage feature rollouts, conduct A/B tests, and track user interaction events within the VWO platform. Key features include the ability to specify custom bucketing seeds for consistent user group assignments (v1.41.0), automatic session management (v1.37.0) to link server-side decisions with client-side experiences, and a flexible `Connector` API (v1.35.0) for custom persistent storage of VWO settings. Notably, a significant architectural change in v1.36.0 shifted the SDK from a singleton model to supporting multiple isolated instances, enhancing flexibility for complex application architectures.
npm install vwo-fme-node-sdkVerified import paths — ran on the pinned version, not inferred.
Demonstrates initializing the VWO client, evaluating a feature flag, retrieving a variable, tracking an event, and gracefully shutting down the client in a TypeScript environment.
Ensure `vwoClient.shutdown()` is called before your application process exits or when the client is no longer needed. For example, in a server, call it during the server's graceful shutdown hook.
Review any code that might have depended on shared state across `vwoClient` instances. Ensure each instance is managed and configured independently. If global access is still desired, manually manage a single instance or pass it explicitly.
To enable group-based bucketing, include `bucketingSeed: 'your-group-id'` in your user context object when calling `getFlag` or `trackEvent`.
When initializing `vwoClient` or in the user context, if you want your `id` to be the UUID, ensure it's a stable identifier. You can retrieve the assigned UUID via `flag.getUUID()` to pass to other clients.
Extend the `StorageConnector` class and implement `getSettings`, `setSettings`, `get`, and `set` methods. Pass an instance of your custom connector to the `init()` options: `{ storage: new MyCustomStorageConnector() }`.If using Node.js with ES modules (`"type": "module"` in `package.json` or `.mjs` files), use `import { init } from 'vwo-fme-node-sdk';`. If strictly using CommonJS, ensure your environment correctly handles the module interoperability or use a bundler that transpiles correctly. Often, switching to ESM imports is the most straightforward fix.Always `await` the `init()` call to ensure the VWO client is fully initialized before attempting to use any of its methods like `getFlag` or `trackEvent`. Wrap SDK usage in an `async` function.
Always check if the `Flag` object returned by `getFlag()` is valid before accessing its properties or methods, e.g., `if (feature && feature.isEnabled()) { ... }`. Ensure your `sdkKey` and `flagKey` are correct and the client is properly initialized.No dependency data recorded yet.