colossal-alligator-31194
09/14/2023, 8:30 AMcountry not equal to 'GB'.
trackingCallback: async (experiment, result) => {
await sendSomeEvent(experiment, result)
},
when I test it manually everything seems right and trackingCallback ( and sendSomeEvent ) is not being called*. But* in larger scale when the code is on production I see events are being called for country GB which is not expected coz I want to exclude that country.
( I'm setting country as an attribute )
growthBook.setAttributes({ country });
I don't understand why this is happening.billions-xylophone-11752
09/14/2023, 11:11 AMproduction
environment? The screenshot you shared shows your preprod
environment rules.colossal-alligator-31194
09/14/2023, 11:22 AMexport const growthBook = new GrowthBook({
trackingCallback: async (experiment, result) => {
await sendSomeEvent(experiment, result);
},
});
const setGrowthBookAttrs = ({ id, country }: { id?: string; country?: string }) =>
growthBook.setAttributes({
id,
...(country ? { country } : undefined),
});
export const initiateGrowthBook = ({ country }) => {
const id = "Getting this from cookies";
initSelfHostedAPI(growthBook);
setGrowthBookAttrs({ id, country) }); // set attributes after initiating GB
};
useLayoutEffect(() => {
initiateGrowthBook({ country });
}, []);
billions-xylophone-11752
09/14/2023, 1:25 PMcountry
may not be defined at the time of bucketing, but it is available by the time the trackingCallback is fired.
I can confirm that this is not a limitation of the free self-hosted plan.
One thing that might be helpful is when you're initializing GrowthBooth, you can set enableDevMode: true
and then use our Chrome DevTool Plugin. This allows you to see what attributes GrowthBook has access to.colossal-alligator-31194
09/14/2023, 1:47 PM