Hi Trying to run a simple gb.isOn("ff-name"); comm...
# ask-questions
m
Hi Trying to run a simple gb.isOn("ff-name"); command with a simple HTML tag setup. I wrapped it with growthbook_queue push command like so:
Copy code
window.growthbook_queue = window.growthbook_queue || [];
window.growthbook_queue.push((gb) => {
  if(gb.isOn("ff-name"))
    console.log(true);
  else
    console.log(false);
});
and then I load the SDK
Copy code
<script async
  data-api-host="<https://cdn.growthbook.io>"
  data-client-key="sdk-..."
  src="<https://cdn.jsdelivr.net/npm/@growthbook/growthbook/dist/bundles/auto.min.js>"
></script>
I'm testing a user that I know for a fact that the app targeted to participate in this feature (meaning the console suppose to print true). yet when the page loads, the scripts above runs, and the console prints false. Only when running the same command manually in the console a couple of seconds later the result is back as true. I tried to run the code with/without the async script attribute - the results are the same. Am I missing something here?...
f
How are you targeting that one user?
can you have the console.log print out the gb object to make sure the attributes are set correctly?
m
I hope I understand you correctly, this is the result when the page loads:
and this is a couple of seconds later:
f
well, thats all async - but in that console.log
you can add gb.getAttributes();
see if the attributes used for targeting match what you're targeting in the growthbook rule
m
ok I think I've solved it, thanks 🙏