Hey everyone, I’m running into an issue I can’t q...
# ask-questions
a
Hey everyone, I’m running into an issue I can’t quite figure out. The documentation mentions that passing an ID helps keep track of which variation a user has been served. In our setup, we’re using Node.js with React, and we have multiple tests running across different pages. Is there a way to get information about which variations a user has seen? While I know we can use
trackingCallback
or
gb.getDeferredTrackingCalls()
, the challenge arises when we’re streaming components, as we don’t always have access to cookies to store user information (albeit we could use redis or some other system). Is there an API call or another approach I might be missing to retrieve this information directly? For now, I’ve worked around it by passing the info to the client and handling it client-side in the browser, but I’m curious if there’s a more robust solution. My goal is to have access to which variations and feature flags have been seen by a user so i can pass it to various api calls / tracking. I hope that makes sense and thanks in advance for any advice!
s
Do you have access to the user id and GrowthBook feature flag data?
a
I always have access to the user id, I have access to whatever is available server side at the time the trackingCallback runs. I could call an api call at any point if there’s something in the gb api I could use. So I can access what tracking has been seen at that time but that doesn’t give me a way to view everything a user has seen throughout history. I can do a work around and call things on the client at the time someone sees it and create my own history but I was wondering if there’s something that gb has that I’ve missed
I think I blabbered a bit, does that answer your question?
s
Yes. Our feature flag/experimentation evaluation is deterministic, so as long as you have the data that comprises the feature/experiment, then you can see how it's evaluated using the SDK (like
gb.evalFeature("headline-cta")
). That'll show you the resolved value and other info. I think that might provide the info you need. Lmk! https://docs.growthbook.io/lib/js#evalfeature
a
Ok that’s cool it has given me an idea, I could theoretically get a list of all features and then loop through and evaluate each. So what if I needed to evaluate which features a person has seen? Is there a way to get that information from the sdk? So a user may only go through a particular flow and may only see 3 out of 5 features. I would only want to get information about the ones they’ve seen.
Appreciate your help and responses Ryan
s
GrowthBook doesn't log exposure events itself—it uses your event tracker like GA or Segment—to send those events to your data warehouse. So, there isn't a direct path there to getting that data. We do have a
onFeatureUsage
callback available with our SDK. Depending on your setup, you could use that to either log those events locally or in a db. However, there may be other options, too. Can you share what the goal is with a particular flow?
a
I see yeah that does kind of answer my question of if there was something I was missing. Our flow we wanted to do was essentially: Every time a user sees a variation add store that somewhere so that when we call tracking codes or our API e could send through a collated list of feature information that the user has seen throughout that journey. The main use would be so that our rest api could rely on certain headers to turn features on and off. Secondly then we could utilise the same for tracking codes and send a full list of things someone has seen. However I think the path through may be to send our api the same user id generated for the FE and then pass that into the sdk to check the feature flags If we send the same id through to the js and php sdk to check if the feature is on for that user, will your system evaluate the user to see the same variation across different sdks?
s
Yes, as long as the IDs are the same, then they'll be evaluated identically. One other option that may works is prerequisites. I'm not sure if it'll fit your use case exactly, but it may offer a solution: https://docs.growthbook.io/features/prerequisites
a
Thanks! I’ll dig into that and then I think I can see a way through! Appreciate the help!
🙌 1