Date of slack thread: 5/28/24
Anonymous: Can I pass the stableId generated in the client SDK to my backend so I can use that for checking experiments in the backend? How can I access it? Is it better to use that stableID or generate one?
Statbot: Yes, you can pass the stableID
generated in the client SDK to your backend to use for checking experiments. To access the stableID
in the client SDK, you can use the Statsig.getStableID()
function. Here’s how you can retrieve it:
const stableID = Statsig.getStableID();
As for whether it’s better to use the stableID
generated by Statsig or to generate your own, the documentation suggests that if you have your own form of stableID
and would prefer to use it instead of the Statsig generated ID, you can override it through StatsigOptions
when initializing the SDK:
const opts: StatsigOptions = { overrideStableID: "my_stable_id" };
await Statsig.initialize("client-xyx", null, opts);
Using the stableID
generated by Statsig is a good default choice, especially for device-level experiments or when other user identifiable information is unavailable (e.g., logged-out users). However, if you have a specific reason to use your own identifier that aligns better with your system’s design or requirements, you can choose to override it as shown above [source].
Statbot: Click below to mark as resolved.
Statbot: This thread has been marked as resolved. Press below to re-open.