Identity merge in Mixpanel, Amplitude and PostHog explained

Identity merging connects events that belong to the same person across anonymous visits, authentication and devices. A reliable implementation uses one stable application user ID, preserves the anonymous identity until the supported linking step and resets identity at a real logout boundary. Mixpanel, Amplitude and PostHog implement these steps differently, so diagnose the project mode, software development kit (SDK) and actual event payloads before attempting to merge existing profiles.

Jafrin Akter AloLast updated 15 min read
On this page
White and pink halves of a circular ring join around a lime loop and blank white tag, beside Identity Merge Explained.

If one customer appears as three users, the first question is where the identifiers diverged. The browser may send a database ID, the backend an email and a billing integration a customer ID. Calling every one of those values “user ID” does not make them interchangeable.

The opposite failure is worse: several people appear as one user because a shared browser, a reused placeholder or global server state assigned their events to the same identity. A lower user count is not evidence that the merge worked.

Which identities must stay separate?

Keep person, device, analytics profile, workspace and billing identities separate. A shared device or payer does not prove that two events belong to the same person.

Which identities must stay separate?
IdentityMeaningCommon wrong substitution
Application user IDStable identifier for an authenticated personMutable email or shared placeholder
Anonymous or device IDSupported local identifier before authenticationProof of a unique human
Analytics profile IDDestination’s representation of a resolved userAn application access credential
Account or workspace IDOrganisation or product environmentThe person performing an action
Billing customer IDPayment-system record linked to a commercial accountEvery user who belongs to that account

One person can use several workspaces and devices. Several people can share one account, browser or payer. Model those relationships rather than merging them all into a person.

Choose the application user ID once, including string format and namespace. user_1042, 1042 and an email address are different identifiers until a supported mechanism links them. Preserve leading zeros and case where they are part of the identity; do not apply text normalisation to IDs without understanding the source.

Use email as a mutable attribute when a stable internal key exists. A customer changing their address should not require recreating their analytics history.

Document the identity fields in your tracking plan, including namespace, producer and reset boundary. For identity resolution across customer relationship management (CRM) and billing, maintain the person-to-account relationships separately. Our product analytics implementation service can trace that contract across the browser, backend and destination before a repair changes historical reports.

When should identity change during authentication?

The desired lifecycle has four transitions: anonymous browsing, successful authentication, continued authenticated use and logout.

Before authentication, keep the same permitted anonymous identity across the visit. After the application verifies the user, apply the stable user ID through the SDK's supported method. On a later page load with an authenticated session, restore that identity consistently. At logout or a genuine transition out of the authenticated session, reset the client identity according to the SDK's rules.

How the workflow fits together
Preserve anonymous identity, verify authentication, apply the canonical person ID across producers, then reset at logout before the next anonymous session.
Read diagram as text
  • Anonymous activity with stable local ID to Application verifies authentication.
  • Application verifies authentication to Apply canonical user ID.
  • Apply canonical user ID to Client and server events agree.
  • Client and server events agree to Logout or authenticated session ends.
  • Logout or authenticated session ends to Reset client identity.
  • Reset client identity to New anonymous activity.
  • New anonymous activity to Application verifies authentication
Open full diagram

Do not treat an initial loading state as logout. In a single-page application, user = null may mean that the session request has not returned yet. Resetting on every such render can split one anonymous visit into many identities.

Make authentication state explicit, for example loading, anonymous and authenticated. Trigger identity changes from actual state transitions. This is application design guidance; the SDK does not know whether your null means “loading” or “signed out.”

Apply the application's tracking-permission policy throughout. Changing an identifier does not create permission to collect events that were otherwise disabled.

Which tools can analyse anonymous and logged-in users in one cohort?

Mixpanel and Amplitude can: both count a visitor who never logs in as a user, so event-based cohorts can include that visitor, and both attach a visitor's earlier events to the person after login. PostHog can only when anonymous visitors get person profiles: under its default identified_only setting, anonymous events cannot form cohorts.

Which tools can analyse anonymous and logged-in users in one cohort?
ToolEvents sent before loginVisitors who never log inEffect on counts and the bill
Mixpanel (Simplified ID Merge)$user_id is set retroactively on earlier events with the same $device_id; propagation can take up to 24 hoursCounted under a $device: distinct ID; Free can build cohorts but not save themEvent billing by default, and $identify and $merge are not billable events; the MTU plan is Enterprise only
AmplitudeThe device's earlier anonymous events receive the identified event's Amplitude IDCounted as unique users with their own Amplitude ID; behavioural cohorts start on PlusOn MTU billing a merged user counts once, but merges after the month's final calculation do not lower the count
PostHogPast events are attributed to the person after identify and stay billed as anonymousUnder the default identified_only, anonymous events cannot form cohorts; person_profiles: 'always' captures every event as identifiedAnonymous events can be up to 4x cheaper than identified ones; the first 1M events a month are free either way

Mixpanel's Simplified ID Merge guide documents the retroactive $user_id, the propagation delay and the $device: distinct ID for unidentified events. Its billing documentation excludes $identify, $create_alias and $merge from billable events, and the plan comparison lets Free users create cohorts without saving them, while Growth includes unlimited saved cohorts.

Amplitude's unique-user documentation shows anonymous events taking the identified event's Amplitude ID and counts device-only visitors as unique users. Its MTU guide counts anonymous users by device ID and known users by user ID, and stops updating the count after the final monthly calculation. The pricing comparison excludes behavioural cohorts from Free and allows 20 per organisation on Plus.

PostHog's guide to anonymous and identified events lists cohorts, person-property filters and Lifecycle insights among the things anonymous events cannot do, while trends and funnels still work on them. Setting person_profiles to always makes the mixed cohort possible at the identified-event price. If that is too expensive, keep cohorts for people who logged in and analyse anonymous traffic with event properties. PostHog's People documentation adds that duplicate profiles inflate counts that rely on person profiles, such as cohort sizes.

In all three tools the clean merge is anonymous to known. Mixpanel's Simplified API cannot merge two $user_id values, Amplitude cannot merge user IDs, and PostHog refuses a merge between already identified users, as the Amplitude and PostHog sections below explain. A visitor who browses on a phone and logs in only on a laptop also stays two users, because no event links the phone's device ID to the account.

Decide whether the cohort counts people or devices before reading it. As visitors log in, the anonymous part of a cohort shrinks and the identified part grows, so compare cohorts of the same age. The fixture under Which tests prove that linking and separation both work? checks both the link and the separation, and the guide to building retention cohorts covers entry rules and denominators.

How does Mixpanel’s identity mode change the implementation?

Check whether the project uses Simplified or Original ID Merge before choosing a linking method. Mixpanel’s identity overview says the mode cannot be switched directly once a project contains data. Original mode uses identity events with different cluster behaviour, so an old alias recipe should not be applied indiscriminately to a Simplified project.

For Simplified ID Merge, $device_id and $user_id establish the identity mapping. The client flow is to call identify after authentication, send an event carrying the identified context and call reset at logout. The documented link requires an event containing both identifiers; merely seeing the identify call in application code is insufficient evidence. Here, an application programming interface (API) is the collection interface used by the SDK or integration.

When troubleshooting, inspect the event before authentication and the first event afterwards. Confirm that the expected device identifier survives the transition and the user identifier matches the backend's format.

For server events, follow the identity fields required by the project's mode and ingestion path. Do not assume that manually sending an arbitrary distinct_id produces the same linking behaviour as the configured browser SDK.

Keep an inventory of customer data platform (CDP) or connector settings alongside the project mode. A correct frontend and an integration using another identity convention can still produce fragmented events.

Why does an Amplitude Identify call not replace setting the user ID?

In Amplitude Browser SDK 2, setting the user ID establishes the application identifier; an Identify object changes user properties. Amplitude's unique-user documentation describes device IDs, user IDs and Amplitude IDs. Anonymous activity can be associated with a known user when the linking evidence is present. It also states that Amplitude cannot merge two different user IDs through that normal identity mechanism. Sending one person under two permanent user IDs therefore requires more than a later profile-property update.

Setting an email property through an Identify call does not change the canonical user ID. Use setUserId as documented in Browser SDK 2, then inspect the emitted event rather than relying only on the visible profile property.

Amplitude's browser identity-reset documentation says reset clears the user ID and generates a new device ID. Use that at the intended logout boundary so the next person's activity does not inherit the previous identity context.

Check both the SDK package and version before copying a code example. Legacy JavaScript examples using getInstance() and current Browser SDK examples are not interchangeable syntax.

If browser events use user_1042 and a worker uses 1042, fix the producer contract. Document the affected historical interval and evaluate supported recovery options separately from the code correction. Future consistency does not prove past reports have been repaired.

When should PostHog identify, alias or repair an identity?

Use identify for a supported anonymous-to-known link, alias for supported additional IDs and a separate reviewed procedure for historical repair. PostHog's identification guide describes linking anonymous activity with a known distinct ID through identify. Aliasing connects supported additional identifiers but has restrictions on IDs already used for identified profiles. It is not a general-purpose instruction to merge every pair of records that looks similar.

The same guide documents reset at logout. It also describes reset(true) for resetting the device ID, a separate option worth checking against your intended device analysis.

For existing incorrect links, PostHog offers a Split IDs operation, but warns that historical event treatment is not guaranteed. Its force-merge operation is explicitly presented as dangerous and without normal safeguards. Use the documented repair workflow only after proving which records represent the same person and understanding its consequences.

PostHog's People documentation describes ingestion warnings when a merge between already identified users is refused. Check those warnings when identify or alias calls appear to run but profiles remain separate.

Also distinguish anonymous events from person profiles. A recorded anonymous distinct ID is not automatically evidence of a duplicate known customer. Investigate whether the person ever authenticated on that device and whether the expected linking event arrived.

How do browser and backend events use the same person ID?

Choose a single function or service contract that produces the analytics user ID from the authenticated application identity. Reuse its result rather than rebuilding the string independently in a browser, API and background worker.

Where an anonymous browser event must link to a server-side signup event, pass the appropriate browser identity context through your supported collection path. Validate that it remains attached to the correct request.

An analytics header is untrusted client input. It can help attribute a measurement event, but it must not determine which customer's records the server allows someone to read or change. Authorisation belongs to the application's authenticated context.

On the server, keep identity scoped to each request or job. A process-wide mutable “current user” can leak one request's identity into another when requests overlap. Background jobs should carry the relevant actor and account context explicitly, and system-generated events should not invent a human actor.

For business-to-business (B2B) products, changing the active workspace should update workspace or group context. It should not replace the person's user ID with the workspace ID. The single customer view guide explains the underlying person-to-account relationships.

How do you find the producer causing duplicate profiles?

Choose one affected test user and collect a small chronological trace across the relevant producers. Include the event name, occurrence time, source, anonymous identifier, user identifier and account or workspace context. Use approved test data rather than copying customer details into an unrestricted debugging document.

Work through these failure patterns:

  • Anonymous activity stays separate after signup: check whether the device identity changed before linking, whether the destination received the linking event and whether the project mode supports the expected mechanism.
  • Only backend events are separate: compare exact user ID strings and project credentials. Check whether a billing customer or account ID was incorrectly used as a person ID.
  • One person becomes many on page reload: check repeated SDK initialisation, disabled persistence and reset calls tied to loading or render states.
  • Two people become one on a shared browser: inspect logout reset, session expiry and any reused placeholder ID.
  • An email change creates another user: check whether email was used as the primary identifier and whether the application changed the value sent to analytics.
  • Only some devices remain separate: confirm that authentication sets the same canonical user ID on every platform and that events are reaching the same intended project.

Do not start with a bulk merge. First stop the producer that is creating the defect. Otherwise, a repair job has to compete with new bad data.

Which tests prove that linking and separation both work?

A good identity test proves two things: one person is connected where evidence supports it, and different people stay separate.

Use an explicit fixture such as this planning record:

YAML
scenario: two_people_and_two_browsers
known_users: [user_1042, user_2087]
steps:
  - browser: one
    action: anonymous_visit
    local_identity: anonymous_a
  - browser: one
    action: authenticate
    user_id: user_1042
  - browser: one
    action: apply_user_id_and_emit_event
    user_id: user_1042
    local_identity: anonymous_a
    expected_link: anonymous_a_to_user_1042
  - browser: two
    action: authenticate
    user_id: user_1042
  - browser: two
    action: apply_user_id_and_emit_event
    user_id: user_1042
    expected_known_person: user_1042
  - browser: one
    action: logout_and_reset
    next_local_identity: anonymous_b
  - browser: one
    action: authenticate
    user_id: user_2087
  - browser: one
    action: apply_user_id_and_emit_event
    user_id: user_2087
    local_identity: anonymous_b
    expected_link: anonymous_b_to_user_2087
must_remain_separate: [user_1042, user_2087]

This is a test specification, not executable SDK configuration. Apply the user ID through the tool's supported method, then emit an event carrying the required identity context. For Mixpanel Simplified, verify both $device_id and $user_id on that event. Execute the fixture against the actual project and inspect the resulting profiles and events; identifiers and processing delay depend on the tool and SDK.

The intended result contains two known people. The first person's two browser sessions resolve together; the second person's session remains separate. Do not expect every raw identifier to disappear from exports, or infer the result solely from a total-user chart that also includes unrelated anonymous activity.

Extend the fixture with app reopen, session expiry, a failed login, account switching, another device and delayed backend delivery. Include the application state in which tracking is disabled. A reset must not accidentally re-enable collection.

What can be repaired in historical identity data?

Separate three work items: fixing future event production, evaluating historical identity repair and updating reports affected by the defect.

Review why ID choices are so costly to change when choosing the repair boundary and the downstream reports that need rebuilding.

For each proposed historical link, retain evidence from an authoritative relationship in your product. Matching names, similar emails or shared network addresses are not enough to conclude that two profiles represent the same person.

Export an appropriately scoped diagnostic record before a repair and confirm the vendor's supported operation for the actual project mode. Check profile-property conflicts, affected cohorts, experiments and downstream audiences. Some changes influence more than the user-count chart.

When a historical repair cannot be established or performed reliably, mark the affected period and define a trustworthy reporting boundary. A warehouse model may support a separate reconciled analysis if the necessary source mappings exist, but that does not automatically rewrite the product tool's historical identities.

Do not delete users merely to make a count agree with a target. Deletion and recollection can remove evidence, alter reports and introduce another break. Choose a supported migration or correction based on the documented data and intended outcome.

How should you interpret changes in metrics and billing?

Identity defects can change conversion, retention, cohort membership and user-based billing measures. On a monthly tracked user (MTU) agreement, compare the corrected identity behaviour with the contract’s billing definition. The exact commercial effect depends on the platform and your contract; a corrected profile count does not guarantee a retroactive invoice adjustment. The MTU and event billing guide shows how unlinked identities and event volume affect different commercial meters.

Compare reports using the same dates, filters, environment and entity. A CRM account count should not equal a product analytics person count when accounts contain several people. Likewise, anonymous visitors who never authenticate cannot all be reconciled to a database user.

After a correction, explain any visible change in the metric. A lower distinct-user denominator can raise a conversion rate even when no customer behaviour changed. Keep that measurement change separate from claims of product improvement.

Use the product analytics setup guide to connect identity tests to the reports that depend on them.

What must pass before an identity change is released?

Release only when the same person links correctly, different people remain separate and affected history has an explicit treatment. Run these checks against the actual destination and recorded SDK versions.

Checklist

  • The canonical person ID is stable, documented and consistently formatted.
  • Person identity remains separate from account, workspace and billing IDs.
  • Project identity mode and SDK versions are recorded.
  • Anonymous identity survives the intended linking transition.
  • Authenticated identity is restored on app reopen.
  • Logout and session-expiry behaviour prevent cross-person contamination.
  • Client, API and background-job events use compatible identity contracts.
  • Loading states and ordinary renders do not trigger unnecessary resets.
  • Positive-link and required-separation fixtures pass in the actual destination.
  • Historical repair limits and affected reports are documented.

Continue monitoring for identity regressions after release, with the same positive-link and required-separation cases.

If funnels remain fragmented after these checks, our product analytics service can trace the identity lifecycle across the application, collection layer and destination. The useful deliverable is evidence of correct linking and separation, with a clear boundary around any history that cannot be repaired.

For a trace you cannot reconcile, start with the $99 martech audit, or request a detailed product analytics scope. Bring the expected identity transitions and one failing fixture so the work has a verifiable outcome.

Keep reading

Browse all Product Analytics guides

Questions people ask

How should support impersonation sessions appear in analytics?

Record the authenticated operator separately from the customer or workspace being inspected. Do not identify the employee as the customer merely to make the session look familiar in analytics. Decide whether impersonated actions belong in product-adoption reports, and label or exclude them accordingly. Test the transition out of impersonation so the next genuine customer action cannot inherit the operator’s temporary context.

How do we test an identity fix while old mobile versions remain active?

Keep fixtures for both the corrected version and the oldest version you still support. Compare their emitted identifiers and the destination’s linking result before assuming the web fix covers mobile traffic. Record the affected app versions in the incident boundary. If old versions continue producing incompatible identities, the rollout plan needs containment or an upgrade strategy as well as new code.

Who should approve an identifier-format change across teams?

Have the owner of the application identity approve the mapping, then involve the owners of every producer and important consumer. Web, mobile and background jobs must agree on the exact format. Analytics and lifecycle owners should assess reports and audiences that depend on it. Keep one change record with examples, rollout order and the historical boundary, rather than separate undocumented fixes.

What if a new signup reuses a deleted customer’s email address?

Treat the email match as insufficient evidence that the new application person is the former person. Follow the product’s approved account-restoration rules and preserve the distinction between a new identity and a verified restoration. Test this case before automatically linking histories. An apparently convenient merge can attach the former customer’s behaviour or account relationships to someone who should remain separate.

How should a billing integration supply identity for a company payment?

Keep the payment attached to the commercial account or billing customer unless there is evidence of the individual actor. Do not select an arbitrary contact as the person responsible for every renewal or invoice. Maintain the account mapping and event meaning explicitly, then use the destination’s supported group or account model where appropriate. Reconcile the payment independently from the person-level engagement report.

Sources

  1. Mixpanel: Identity management overview
  2. Mixpanel: Identifying users with Simplified ID Merge
  3. Amplitude: Track unique users
  4. Amplitude: Browser SDK 2
  5. Amplitude: Browser cookies, consent and identity reset
  6. PostHog: Identifying users and repair limitations
  7. PostHog: People and duplicate profiles
  8. Mixpanel: Pricing and billing documentation
  9. Mixpanel: Plans and pricing
  10. Amplitude: MTU guide
  11. Amplitude: Pricing and plan comparison
  12. PostHog: Anonymous and identified events
Portrait of Jafrin Akter Alo

Written by

Jafrin Akter Alo

Data Engineer and Co-founder at Martechdevs and Growth and Analytics Partners

Jafrin writes practical guides to marketing technology, customer data, analytics and AI workflows. Martechdevs is a Growth and Analytics Partners company.

View LinkedIn profile

Book a Free Call

Thirty minutes on your stack and what it needs. Free, and no pitch.

Thirty minutes, and you leave with a plan

We look at what you have, what it is costing you and what to do about it first.

  • 30 minutes
  • Video call, link on booking
  • No obligation

What we'll cover

  • Your current stack and where it hurts
  • Quick wins we can ship first
  • An integration roadmap
  • Timeline, scope and next steps

Calendar not loading? Open it in a new tab or email hello@martechdevs.com.