Segment alias + identify ( server / client )

Hey,

I noticed Expo’s Segment doesn’t support alias.

Segment creates an anonymous id for the session
When a user registers, we’re supposed to call alias.

alias takes the anonymousId and sets it to previousId
alias takes the newly generated user id and sets it to the userId

Since alias isn’t supported on the client, I have to call alias on the server, but since I don’t know the anonymous id, I can’t get the anonymousId to sync the users.

Our workflow is simple:
The first thing you have to do is enter a phone #, then get a confirmation code.
You are either a new user (call alias) or a previous user (just call identify)

Does anyone have any suggestions for how I can make this work? We have soo many duplicate users in mixpanel

Thanks!

1 Like

I can be totally wrong but, previousId seems to be something I can set.

I think my workflow will be:

  • User enters phone number

  • (CLIENT) Segment.identify(phone)

  • User confirms sms token sent to phone

  • (SERVER) If new user: Segment.alias(previous: phone, userId: newly generated user id)

  • Send new id to client

  • (CLIENT) Segment.identifyWithTraits(new user Id)

Also running into this, doesn’t seem possible in-app to use the aliasing or autotrack from Mixpanel Destination | Segment Documentation

1 Like

Created a canny feature request

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.