Integrate the SDK
Integrate the FlagSync JavaScript SDK to use your feature flags in code.
Using the JavaScript SDK
With your new-feature
flag created, bring it into your app with the JavaScript SDK.
Check out our other SDKs for Node.js, Next.js, React, and more.
Install the SDK
Install the package via npm:
Initialize the SDK
Create a client with your SDK key and a unique user identifier, such as user ID or email.
Get your SDK key from your Workspace settings for the target Environment.
Wait for Readiness
Ensure the SDK is ready before checking flags:
Evaluate Your Flag
Get the new-feature
flag’s value:
Calling flag()
automatically logs an impression, tracking which variant each user sees—vital for metrics later.
Putting it all together
Here’s the full example:
Next Steps
The SDK is ready—now track user actions:
- Send events in Quickstart: Send Events.
- Explore targeting in Targeting & Rollouts.
- See other options in other SDKs