-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bulletTrain.segment is throwing an error. #30
Comments
You cannot get whether a user belongs to a segment directly, we may allow such things in the future but that is perhaps a misuse of the library. The idea of segments is to control feature flags and remote config with segment overrides. For your scenario of "trial users" you have 2 options: Option 1: use setTrait and getTrait to detect and set whether the user is a "trial user". Although this approach is simple it may not give you the most flexibility. Suggested approachIt's better to create a feature called "trial_user" and override its enabled state for a segment. I'll explain with some screenshots here to give you a better idea of how this would work: Step 1 : Create your feature flag for trial users, using whatever default you feel is best for on or off Step 2: Create a segment that drives the feature flag Step 3: Set the feature flag to be turned on for that segment Your code would then be driven by |
Hopefully this answers your question! If not feel free to reply and I'll get back to you. |
Hi @kyle-ssg, thanks for suggesting this approach. Works great. |
I'm using React v16.12.0
When I use
bulletTrain.segment
, I get the error below:bullet_train_client__WEBPACK_IMPORTED_MODULE_1___default.a.segment
Full Code
The text was updated successfully, but these errors were encountered: