Hi there, is there someone here experienced with s...
# ask-questions
w
Hi there, is there someone here experienced with setting up experiments using MixPanel as a data source? I'm trying to set up an experiment where the assigned variation stays te same before and after a user authenticates. The anonymous ID (before authentication) and the user ID (after authentication) can both be found in MixPanel and are linked to the same user. Unfortunately GrowthBook still assigns a new variation to this user after authentication, is it possible to make it not do that?
f
what is the SDK implementation you're using?
are you doing something like id = user_id || anon_id ?
w
We're using the SDK implementation for React, and yes something like that. We're using the distinct_id from MixPanel which is based on either the anon_id or user_id.
Technically I could use another identifier like a custom
device_id
which will be the same before and after login. Unfortunately that would also mean that if the signed in user gets a new
device_id
the variation will still change, which is what we don't want.
in TLDR, I want the assigned variation before authentication to stay the same after authentication and then never change again for that user.
f
yes, we recommend not having conditional attributes (two identifiers to one attribute). Use two attributes instead
device id will work for anon and logged in
which is usually what you want
w
I see, it's just that the nature of our business makes the use of
device_id
(or any session/browser kept attribute) difficult.
I did try to configure a second user ID property in the MixPanel configuration. This didn't seem to help though, should it?
If you say this should cover the situation I'm describing I'm willing to give that another shot.
f
mixpanel has an equivalent of an anon id that is persistent - not a session
The query settings there you're editing are for the analysis, not the assignment
"distinct_id" is what you want to use
w
Gotcha in regards to the settings part.
distinct_id
is what we are already using for the
id
attribute (which is also used during assignment). This value will still change if the user signs in though. This is what our code comes down to:
Copy code
GrowthBookSdk.setAttributes({id: mixpanel.get_distinct_id()});
f
it should not change after login
w
Actually, might be because of our identify calls:
If your project does not have ID Merge enabled, identify will change the user's local distinct_id to the unique ID you pass. Events tracked prior to authentication will not be connected to the same user identity. If ID Merge is disabled, alias can be used to connect pre- and post-registration events.
I will dig into this for a bit, seems that this might be the cause of the issues we're facing. Thanks in advance @fresh-football-47124!
So in MixPanel we are using ID Merge using the Original API. Which makes the change of the
distinct_id
after an
identify
call the "expected" behaviour. From the documentation:
The distinct_id is automatically determined by Mixpanel using one of the IDs in the cluster and is not user-configurable. Any IDs in the cluster can be used for ingestion.
https://docs.mixpanel.com/docs/tracking-methods/id-management#simplified-vs-original-api-key-differences
This of course is directly opposed to what GrowthBook expects, which makes for an interesting combination.
l
👋 we also faced exactly this annoyance and issue, and wasted a bunch of time poking around it. @fresh-football-47124 - while it's a quirky on Mixpanel's side, and i appreciate that Mixpanel isn't recommended any longer, it might be worth a short note in the Mixpanel docs to note this quirk. I saw a few people in Slack getting stuck on this issue in the past.
💯 1