1
Install the Statsig SDK
2
Import the Statsig SDK
3
Creating a StatsigServerlessClient instance
sdkKey : stringThis is your Statsig client API key. It is available from the Project Settings page in the Statsig Console. This is used to authenticate your requests.options : StatsigOptionsSee here for more options.
4
Client Initialization
The following line initializes the client by loading feature gate and experiment configurations over network
5
Checking a Gate
checkGate method takes two arguments:name : stringThe name of the Statsig gate that you are checking.user : StatsigUserThe Statsig user object for whom the gate is being checked. For more information on the user object, see here.
6
Logging an Event
logEvent method takes two parameters:eventOrName : string | StatsigEventThis is the name and details of the event you are logging.user : StatsigUserThe Statsig user object for whom the event is being logged.
7
Putting it all together
index.js