When Should You Call Identify and Reset in Mixpanel?

In a Mixpanel project using Simplified ID Merge, establish identity when your application knows who the user is, and reset it when that authenticated context ends. The important detail is where those calls sit in your application’s lifecycle.

This article focuses on placement and testing. Check your project’s identity version and SDK documentation before applying the examples to an older implementation.

Use authentication success as the trigger

Do not identify someone merely because they typed an email address into a form. Wait until authentication succeeds and the application has the stable account ID.

Likewise, a clicked Login button is not a successful login. An incorrect password should not attach a browser’s activity to the account entered in the form.

Cover the full lifecycle

Application stateRecommended implementation check
Successful signup or loginIdentify using the authenticated account ID
App opens with a valid existing sessionRestore the intended analytics identity before dependent activity
Logout or authenticated session endsReset the client identity
Account switchEnd the old identity context before establishing the new one

A minimal example

This illustrative JavaScript assumes an initialized SDK and successful application authentication:

// After successful authentication:
mixpanel.identify(authenticatedUser.id);
mixpanel.track("Signed In", { login_method: "password" });

// When the authenticated user explicitly logs out:
mixpanel.track("Signed Out");
mixpanel.reset();

Sending the sign-out action before resetting retains its association with the departing account. Coordinate this with your application’s real logout process; this snippet does not implement authentication or session termination.

Do not reset on every page load

My recommendation is to avoid using reset as a generic initialization step. Repeatedly starting a fresh anonymous identity can make a normal journey harder to interpret. Review whether a helper function is being invoked more often than its author intended.

Also inspect single-page application routing. A route change should not accidentally run the same identity transition as a complete account switch.

Test two accounts on one browser

  1. Log in as test account A and perform a recognizable action.
  2. Log out and browse anonymously.
  3. Log in as account B and perform a different action.
  4. Inspect each account’s event history.
  5. Check that B’s actions and customer-specific properties are not attributed to A.

Repeat after a session expires and after reopening the application with an existing valid session. These paths often use different code from the normal login screen.

Assign an owner

Put identity calls in a documented authentication workflow rather than scattering them across unrelated tags. Ask both the authentication owner and analytics owner to review changes. A small lifecycle mistake can affect funnels, retention, and customer segmentation long after the release that introduced it.

Need help with your Mixpanel setup?

Optizent helps teams plan, implement, and troubleshoot analytics. Contact Optizent to discuss your Mixpanel tracking or reporting needs.

References

GET EXPERT ANALYTICS HELP

Need help getting reliable answers from Mixpanel?

Tell us about your tracking, funnels, retention, or reporting challenge. Optizent can help you implement, audit, and use Mixpanel with confidence.

We will use these details to respond to your request. Please do not include passwords, account access, or customer data.