Solved

Is calling "alias" enough to link two users so that they count as one MTU?

  • 21 January 2021
  • 3 replies
  • 53 views

Badge

We’re doing signup tracking but not doing much past that, but are about to start doing a bit more tracking after the signup and I do not want to incur double MTUs because of a faulty alias/identify setup on my part.  Currently, as soon as the signup is successful the client is calling mixpanel.alias with the user’s new ID from our backend.  Is that enough to ensure that if the backend then tracks an event for that user using only the user id that it will NOT count as an additional MTU?  The backend does not currently have any clue what distinct id was generated for the user by the client.

Or, is it required that we call mixpanel.identify and/or enable ID merge?

Thanks!

icon

Best answer by mikesnare 27 January 2021, 20:25

The answer to this question after getting some help from support is yes, as long as at least 2 seconds have elapsed between the call to mixpanel.alias and subsequent calls to other mixpanel code using the new ID.  It takes a little time for mixpanel to alias things so you want a little delay.  In my case we delay backend requests by a minute, which give the front end plenty of time to call alias.  Once the alias request has been processed, you can use either id and it will be a single user.

View original

3 replies

Userlevel 3
Badge +1

You should also call

  1. Mixpanel.identify for returning users after they sign in.
  2. Enable id merge to ensure that returning users don’t create a new anonymous id even after signing in.
Badge

Thanks, but I may not have explained the setup well.  We’re still not doing any tracking of any events after login, so calling identify in the client isn’t part of the plan -- unless it’s necessary to get what I’m looking for, which is really the question.  We do not track anything after login (we’re currently only interested in signup flows) and the new events we’re looking to track are sent from the backend and are related to having sent the email address verification email and then processing the link that the user clicks from that email -- both of which are still pre-login events.  However, neither of those can be handled by our mobile clients, so it must be done on the back end, and the backend has no clue what the client’s distinct_id is.  So the backend can only send events using the user’s actual ID, and the front ends will have called mixpanel.alias using the user ID before the backend sends any of these events.

So the first question is whether or not what we’re already doing is enough to avoid double-tracking an individual user in the following scenario:

  1. Clients send events for anonymous user using mixpanel-assigned distinct ID.
  2. Clients detect successful sign up and call mixpanel.alias with the user’s ID.
  3. Server sends events using the user ID.

Is that going to result in one MTU, or two?

If that is going to result in two MTUs, what is absolutely required as a minimum to reduce that down to one MTU?

Badge

The answer to this question after getting some help from support is yes, as long as at least 2 seconds have elapsed between the call to mixpanel.alias and subsequent calls to other mixpanel code using the new ID.  It takes a little time for mixpanel to alias things so you want a little delay.  In my case we delay backend requests by a minute, which give the front end plenty of time to call alias.  Once the alias request has been processed, you can use either id and it will be a single user.

Reply


Mixpanel