https://www.growthbook.io/ logo
#announcements
Title
# announcements
r

rhythmic-chef-84815

08/23/2022, 7:50 AM
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

fresh-football-47124

08/23/2022, 7:55 AM
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

rhythmic-chef-84815

08/23/2022, 7:56 AM
what should I use?
f

fresh-football-47124

08/23/2022, 7:57 AM
do you know the user id?
r

rhythmic-chef-84815

08/23/2022, 7:58 AM
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

rhythmic-chef-84815

08/23/2022, 8:37 AM
but the eval feature calls the tracking, doesn`t it?
f

fresh-football-47124

08/23/2022, 8:37 AM
in this code example, it does not
you could paste in your data and see what a user got
r

rhythmic-chef-84815

08/23/2022, 8:38 AM
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

fresh-football-47124

08/23/2022, 8:39 AM
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

rhythmic-chef-84815

08/23/2022, 8:39 AM
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

fresh-football-47124

08/23/2022, 8:40 AM
okay - I imagine the inExperiment would have fired the trackingcallback at some point
to be true
r

rhythmic-chef-84815

08/23/2022, 8:40 AM
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

fresh-football-47124

08/23/2022, 8:42 AM
ya, you can open a ticket for that
should be a simple feature to add to the UI
r

rhythmic-chef-84815

08/23/2022, 8:50 AM
Done 🙂
👍 1
34 Views