To initialize the client SDK in a way that doesn't retrieve unneeded configuration data for metrics only, you can use the statsig.initializeSync
method. This method should be called with your user object, client key, and options. All the event logging APIs should work just fine, but you won't have the most up to date values for any feature gate or experiment.
If you want a subset of your gates/experiments, you'll still want to await the asynchonrous initialization, but you will need to add a “target app” to your configs and to the SDK key in question. That key will only fetch those configs with the same target app. More information on this can be found in the Target Apps documentation.
If you want to use both the javascript client and react SDK, we recommend the new @statsig
/js-client
and @statsig/react-bindings
libraries
These libraries ensure separation between multiple instances of a StatsigClient, and allow you to use both the react hooks syntax and core javascript sdk.
See https://docs.statsig.com/client/javascript-sdk/react for more.