Using the JavaScript SDK
With yournew-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.
1
Install the SDK
Install the SDK with your preferred package manager:
2
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.
3
Wait for Readiness
Ensure the SDK is ready before checking flags:
4
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.5
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