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

broad-continent-77439

10/10/2022, 4:53 PM
Hey everyone, QQ: how to send the
id
for growthbook (in
setAttributes
) to match the segment one? I tried to send the
ajs_anonymous_id
/
ajs_user_id
as an id. but the problem is those segment cookies are set after growthbook config initialization! Thanks.
f

future-teacher-7046

10/10/2022, 5:19 PM
You can call setAtrributes multiple times. So if you can listen for when segment initializes you can update the attributes to include the id.
b

broad-continent-77439

10/10/2022, 5:23 PM
Thanks @future-teacher-7046 Ah, I thought about that but what happens if I initialized it with a random string as
id
and then I change it to have the segment Id... will that counts as 2 different users that might have two diff experiments?
f

future-teacher-7046

10/10/2022, 5:25 PM
Yes, probably better to initialize as an empty string or null. Then the user won't be part of the experiment until the id is set for real.
b

broad-continent-77439

10/10/2022, 5:33 PM
Got it. Thanks 🙌
19 Views