Is there a way for me to get check if the user is ...
# announcements
r
Is there a way for me to get check if the user is in a variation of a test without adding him to the test in case he is not?
f
yes, though its not automated - all our SDKs use same algorithm, so will return the same variation the user would, or was, be assigned to
r
what should I use?
f
do you know the user id?
r
yes
I tried to find in the docs something like "get features for user" but I could not, am I missing something?
I managed to do it here by getting all results and then the feature and the information I needed
just a quick mock up of how you could fetch that info
r
but the eval feature calls the tracking, doesn`t it?
f
in this code example, it does not
you could paste in your data and see what a user got
r
This is what I do not understand, I want to avoid the "tracking callback" and the evalFeature as far as I am aware by checking the code it will call "getFeatureResult" which then calls "trackFeatureUsage"
f
yes
but I'm suggesting that you need not run it directly with your existing code
if you just want to find what variation they would be assigned to
r
I see, this is actually what I did
Copy code
public isVariationWithoutTracking(experimentName: OngoingExperiments, variation: number) {
    const result = this.growthbook.getAllResults().get(experimentName)?.result;
    return result?.inExperiment && result?.value === variation;
  }
this way I can check both the variation and the feature
f
okay - I imagine the inExperiment would have fired the trackingcallback at some point
to be true
r
Now I understand how you did but having a new growthbook instance seems a bit too much
Maybe as a suggestion we could have this method added to the growthbook library, to check if the user is in an experiment or not with the variation but no tracking
anyway, thanks for the help 🙂
f
ya, you can open a ticket for that
should be a simple feature to add to the UI
r
Done 🙂
👍 1