Initialization

Initialize an instance of vwoClient, which will then be used to manage all feature flags and rules. This vwoClient instance contains all the feature flags and rules you have configured in your VWO dashboard.

Usage

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

const vwoClient = await init({
  accountId: '123456', // VWO Account ID
  sdkKey: '32-alpha-numeric-sdk-key', // SDK Key,
});

As shown above, to initialize the vwoClient, you need to call the vwo.init() function, which requires two mandatory parameters:

  1. accountId : This is the unique VWO account ID which you can find in your VWO Dashboard.
  2. sdkKey : A unique 32-character string corresponding to the project/app created in VWO. You will find this in the Websites & Apps section in VWO.

Parameter Definitions

ParameterTypeDescription
accountId
Required
NumberYour VWO application's Account ID.
sdkKey
Required
StringUnique environment key provided to you inside the Websites & Apps section in VWO application, under "Default Project".
pollInterval
Optional
NumberTime period (in milliseconds) at which VWO should check with the server for any updates to the feature flag or rules in the VWO Dashboard. Useful to keep your vwoClient instance up to date with any changes made in the VWO Application. Polling
logger
Optional
ObjectAn optional logger object that defines the logging behaviour. Logger
storage
Optional
ObjectStorage Service, if required, can be implemented using this parameter Storage Service
gatewayService
Optional
ObjectIf using the FME Gateway Service, this object will specify the location and port of where the gateway service is deployed on your servers.
integrations
Optional
ObjectContains a callback function that receives campaign data which can be pushed to any external tool that you need to integrate with. Integrations

Keeping vwoClient up-to-date

When you initialize the vwoClient at your server, it pulls the latest configurations you've done in the VWO application.
If/when you make any changes to the feature flags or rules within VWO after the vwoClient has been initialized in your server, there needs to be some way to update your vwoClient with the latest settings from VWO. This can be done via polling.


What’s Next