Question

Alias and Identify in a (React) Native App

  • 3 September 2019
  • 1 reply
  • 44 views

Badge

Hi there,

I've done quite a bit of research and testing in the live section, on this topic but I'm still confused on what to do.

I know that I must call 'alias' only once, and that should be on sign up. All good here.

When it comes to 'identify', I know I must call it on log in, which makes sense, but my question, is what if the User only signs up and starts using the app for days/months without ever logging in, which I believe to be a common case especially for native apps?!

- Does this mean I have to call 'identify', right after 'aliasing' when the User signs up?

- Does it mean I have to call 'identify' every time the app starts and the user is logged in?

- Should I do both?

Trying to debug the above cases I recreated a bunch of scenarios:

Scenario A:
1. Start the app fresh by calling mixpanel reset
2. Track some events as an anonymous user
3. Call Alias with a Test User id
4. Track more events

Result: The events at step 4 aren't any different than the ones at step 2 – no User Id assigned.

Scenario B:
1. Start the app fresh by calling mixpanel reset
2. Track some events as an anonymous user
3. Call identify with a Test User ID (never call alias)
4. Track more events

Result: The events at step 4 show the new user id, but the distinct id is also the User Id, not the randomly generated one.

I understand this scenario is not as advised in docs, but just wanted to check it.

Scenario C:
1. Start the app fresh by calling mixpanel reset
2. Track some events as an anonymous user
3. Call Alias with a Test User id
4. Wait a second or more
5. Call identify with the same Test User ID
6. Track more events

Result: The events at step 6 are the same as the events at step 2, as like no User Id was ever assigned to them. This baffles me.

Please advise, on what the bets practice around this use case is!

Thank you,
Gabriel



1 reply

Userlevel 1
Badge

@gctroia If I am understadning correctly, it sounds like the issue is that your users have the option of creating an account and do not have to log out of the after creating an account.

I would not recommend doing Alias and Identify one right after the other as this could possibly cause some race conditions and other problems with your identity management.

Maybe a session-time on your app might help fix the issue?

Our native mobile app times out after a certain amount of inactivity. This forces our users to have to log out and log back into our app. Our company makes our users log into our app as soon as they open it, this way we can capture all their activity asap. However, this brings issues with usability. The trade off to this is that it could skew users to never log back in (I know I get lazy and forget my credentials easily). However, the trade off is something we are okay with in the long term to get our data in a healthy state.

Hopefully my ideas help!


Reply