We're close to launching GrowthBook and have one f...
# ask-questions
l
We're close to launching GrowthBook and have one final question! Our product has both logged-in and anonymous users. Your FAQ <https://docs.growthbook.io/faq#what-do-i-use-for-an-id-attribute-in-the-sdk-if-my-users-arent-logged-in |suggests> we use two identifier attributes, but as far as we can tell, we <https://i.imgur.com/vQOJHGN.png |can only select one>. How might we achieve that suggestion from your FAQ? The goal is for any logged-in user to always see the same A/B test, but that A/B test might also be applicable to anonymous users.
We were thinking about handling this by creating a
user_id_or_anonymous_id
attribute/identifier –
user_id
if they're logged-in and falling back to
anonymous_id
if they're not. That felt a little hacky though, and we wanted some reassurance!
f
The
user_id_or_anonymous_id
will cause users to potentially switch variations when they log in. Our recommended approach is to pick just one identifier type for each experiment. Depending on the specific experiment, you might pick
user_id
or
anonymous_id
. As a general rule of thumb, if the test is shown primarily to only logged-in users, then pick
user_id
. Otherwise, pick
anonymous_id
. If a test has a large amount of both logged-in and anonymous users, I would usually just use
anonymous_id
to split traffic. Users who switch devices or clear cookies may see multiple variations, but for most tests and products, that should be a relatively small percent of users and unless it's something super critical like pricing, not a huge deal if a few people see both variations.
l
Thank you!