fancy-zoo-90893
08/11/2021, 2:55 PMuseExperiment
React hook but all I see is the control message. I would assume that opening on incognito 5 times, one of them should show me the variation?future-teacher-7046
const growthbook = new GrowthBook({
user: {
id: "123"
}
})
By default, experiments use the user's id
property to assign variations. For logged out users, you probably want to use something else like an anonymous cookie id. In that case, you need to change the experiment "hashAttribute":
const growthbook = new GrowthBook({
user: {
cookieId: ...
}
})
...
useExperiment({
key: "my-test",
variations: ["Control", "Variation"],
hashAttribute: "cookieId"
})
The documentation for the react library isn't very clear right now. We'll fix that.fancy-zoo-90893
08/11/2021, 6:45 PMajs_anonymous_id
cookie that Segment sets up and using that.experiment
and variation
, although it looks like the correct ones are experimentId
and `variationId`: https://docs.growthbook.io/lib/react.future-teacher-7046