Hi everyone, where in my nextjs app, am i supposed...
# ask-questions
s
Hi everyone, where in my nextjs app, am i supposed to set window.GROWTHBOOK_CONFIG for the visual editor? I think the growthbook script is being called before the config is set. Thanks in advance
useEffect(() => { const script = document.createElement('script'); script.src = 'http://localhost:3100/js/prod_w1v5U4jkB0JKLtrm3Iq0Qid6IvBToU0BzS3GV5Q.js'; script.async = true; document.body.appendChild(script); window.GROWTHBOOK_CONFIG = { anonId: '123amiraliwerweafroghwowunbeleivab0980996, track: function (experimentId, variationId) { console.log('amirali', experimentId, variationId); }, }; return () => { document.body.removeChild(script); }; }, []);
This works!
One thing: if i set userId instead of anonId, it will go and generate a random id for me. I think there might be a problem in the script.
for me at least, o.a is always 1