Hi there, Just discovered Growth and I think it's great and I'm excited to start using it. I'm try...
j

Josh Pitzalis

about 3 years ago
Hi there, Just discovered Growth and I think it's great and I'm excited to start using it. I'm trying to implement it and I've run into a few snags. Any help would be much appreciated. Our App is freemium so people can use the core feature without needing to signup. This means that we don't always have user details when people use the app. I'm calling the Growthbook context as the app loads and fetching features as instructed in the docs here: https://docs.growthbook.io/lib/js
// Create a GrowthBook context
const growthbook = new GrowthBook();

// Load feature definitions (from API, database, etc.)
fetch("<https://s3.amazonaws.com/myBucket/features.json>")
  .then((res) => res.json())
  .then((parsed) => {
    growthbook.setFeatures(parsed);
  });
My questions are: 1. How does Growthbook know which feature to assign without knowing who the user is at this point? 2. If the user then creates an account and we use use
growthbook.setAttributes()
to update the id, will whatever anonymous tracking token that was used previously be merged into the new ID we give it when the user signups? 3. Our app also allows people to create multiple accounts and switch between them. If this happens do we have to refresh the data? I'm assuming
setAttribute
won't work here as we want to switch to an existing user id not update the existing user with a new ID. Any guidance or direction on how to think about and manage this would be much appreciated.