Hi, I am using react SDK and I have set up the exp...
# ask-questions
v
Hi, I am using react SDK and I have set up the experiment and the GA connection. I am also able to get the feature value but it seems like the
trackingcallback
function is not being called. I am sending an event to GA and also using console.log in the
trackingcallback
. Is there something I can do ensure it runs smoothly ?
f
yes, one easy way to debug is to use the Chrome dev tool: https://chrome.google.com/webstore/detail/growthbook-devtools/opemhndcehfgipokneipaafbglcecjia Another would be to make sure that the experiment is being passed correctly to the SDK - look at the network tab and examine the feature payload.
n
I do have the exact problem, it’s not triggering the
trackingCallback
for certain variation
b
the tracking callback is only called if the user is in the experiment. it will not get called in the following cases: • a forced value is provided •
experiment.active
is not
true
• if there's no hash attribute to help evaluate the experiment (e.g. the custom-provided hash attribute or the fallback
id
on the user attributes) • if the conditions checked evaluate to false • if QA mode is true • the experiment has already been tracked, i.e. the tracking callback has already been called once for this experiment. (keeping track of tracked experiments is not supported in all SDK's currently) In the build-your-own section of the SDK docs, there's a section about implementing the experiment run and when the callback is fired. that should hopefully help clear up any confusion.