Getting All Assignments Instantaneously

How Statsig server SDKs report all feature gate, experiment, and dynamic config assignments for a user in a single call for server-rendered apps.

Statsig SDKs are designed to be invoked at the point in your code where you serve the experiment treatment or feature. For most use cases, call getExperiment, checkGate, or getLayer with the user object and key at the point of use.

Some customers want to capture all assignments (experiments, gates) in a single call, for example in an edge function or on the server at the start of a user's session. This is common when passing assignment information to other applications or using assignments as cache keys for CDN and edge compute use cases.

For this use case, use the getClientInitializeResponse server SDK method to generate the full assignments payload.

Example of capturing all assignments in Node.js

Statsig designed this method to bootstrap the client SDKs. By default, it hashes the experiment and feature keys returned in the payload to prevent end-users from spoofing into features and gates. An optional hash parameter lets you disable hashing and capture all group names and values in plain text: Node, Python, Java, Go.
node
const assignments = statsig.getClientInitializeResponse(userObj, "client-key", {hash: "none"});

Was this helpful?