Prompt
How do I troubleshoot duplicate customer records in Segment?
Latest observation
To troubleshoot duplicate customer records in Segment, start by figuring out where the duplication is happening: at ingestion, during identity resolution, or downstream in a destination.
1) Confirm the duplicate pattern
Check whether the duplicates are:
- Multiple anonymous profiles for the same visitor
- Multiple user profiles with different
userIds - One person appearing twice in a destination like your warehouse, CRM, or analytics tool
This tells you whether the issue is in Segment’s identity merge logic or in a destination-specific sync.
2) Inspect the raw events
Look at the actual tracking calls being sent to Segment:
identifytrackpagescreenalias
Pay attention to:
userIdanonymousIdtraitscontexttimestamp
Common causes:
- Different
userIds are being used for the same person anonymousIdchanges unexpectedlyidentify()is firing multiple times with inconsistent IDs- The app is generating a new anonymous ID on every page load or device/session
3) Verify your identity strategy
Segment deduplicates users based on identity rules, so make sure your implementation is consistent:
- Use a stable
userIdafter login - Keep the same
anonymousIdbefore login - Call
alias()only when needed, typically when connecting anonymous activity to a known user - Avoid assigning multiple
userIds to the same person unless that is intentional
If your application supports login across devices, make sure the same canonical user identifier is used everywhere.
4) Check for multiple sources sending the same data
Duplicates often come from:
- Web and server both sending the same event
- Multiple Segment sources configured for the same app
- A destination receiving the same event through more than one path
- Retrying logic causing the same event to be sent twice
Look for:
- Duplicate source write keys
- Overlapping source configurations
- Server-side and client-side event overlap
5) Review destination-specific behavior
Some destinations create duplicates even if Segment data is correct:
- CRM tools may create a new contact if email or external ID differs slightly
- Warehouses may show duplicate rows if you’re loading event-level data
- Marketing tools may treat merged Segment profiles differently than Segment itself
Check whether the destination uses:
userId- a custom external ID
anonymousId
6) Use Segment’s debugging tools
Depending on your plan and setup, use:
- Source Debugger to inspect incoming events
- Protocols / Schema to spot malformed or inconsistent payloads
- Replay / Event Delivery logs if available
- Browser dev tools or server logs to confirm what is actually being sent
Look for:
- Duplicate
identifycalls - Missing
userId - Conflicting traits
- Repeated
trackcalls from page refreshes or React lifecycle issues
7) Common implementation mistakes
A few frequent causes:
- Calling
identify()on every page load - Generating a new
userIdfor each session - Using email as
userIdsometimes and a database ID other times - Sending both client-side and server-side events without deduping
- Re-initializing Segment multiple times in the app
- Not persisting
anonymousIdproperly across sessions
8) Fix and validate
After correcting the implementation:
- Test with a single test user
- Confirm that anonymous activity merges into the known profile after login
- Make sure only one canonical profile appears in Segment
- Verify downstream destinations stop creating duplicate records
9) If duplicates already exist
You may need to clean them up manually in downstream systems:
- Merge duplicate contacts in CRM
- Deduplicate warehouse tables with SQL
- Rebuild identity resolution logic in your customer data platform
- Backfill corrected IDs if necessary
If you want, I can also help you with:
- a step-by-step Segment duplicate debugging checklist, or
- how to fix duplicates in a specific destination like Salesforce, HubSpot, or a warehouse.