https://www.growthbook.io/ logo
#announcements
Title
# announcements
f

fancy-zoo-90893

08/11/2021, 2:55 PM
I’m using the
useExperiment
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?
If you try opening https://pabio.com, “Rent jaw-dropping interior.” is the first H1 heading (control). I’m A/B testing a new heading “Furnish your apartment on a payment plan.” — but I don’t see it (do you?).
f

future-teacher-7046

08/11/2021, 3:03 PM
How are you instantiating the growthbook object that is passed into the GrowthBookProvider component?
Copy code
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":
Copy code
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.
f

fancy-zoo-90893

08/11/2021, 6:45 PM
Aah, makes sense! I now added support for fetching the
ajs_anonymous_id
cookie that Segment sets up and using that.
This would be an awesome out-of-the-box feature: Supporting the default anonymous ID cookie from Segment, Mixpanel, etc., the platforms you support 😄
The React docs suggest that tracking properties are
experiment
and
variation
, although it looks like the correct ones are
experimentId
and `variationId`: https://docs.growthbook.io/lib/react.
f

future-teacher-7046

08/12/2021, 12:18 PM
Yeah, we should update that example to match the default data source settings so people don't have to go in and change it.
10 Views