Migrate from Segment to Amplitude
Migrating from Segment moves your event collection and data routing to Amplitude, which covers both Analytics and CDP workloads. The migration has three parts:
- Migrate your source and destination configuration.
- Update your SDK implementation to send data to Amplitude.
- Validate the migration.
The following table maps Segment offerings to their Amplitude equivalents.
Keep Segment and send data to Amplitude
If you plan to keep Segment as your collection layer, you don't need to change your tracking code. Connect Segment's Amplitude (Actions) destination instead. Refer to Segment.
Recommended best practice
Follow a strict release process and configure multiple environments. Validate changes within each environment before deploying.
Add a source
To add a new source:
- In Data, click Sources in the Connections section.
- Click Add Source.
- Browse or search for the source you want to add.
- Follow the on-screen prompts.
For detailed instructions, refer to the documentation for the source you want to add.
Update SDK implementation
Segment and Amplitude SDKs both capture first-party data by tracking user interactions, and they work similarly aside from syntax differences. The following table maps concepts between Segment and Amplitude.
| Segment | Amplitude | Notes |
|---|---|---|
| write_key | api_key | Unique key that validates the source of the data. |
| Workspace | Project | Projects organize your data. |
| User | User | The user performing the action. |
| Identify | setUserId and Identify | setUserId sets the user ID. Identify updates user properties. |
| Track | Event | An event in Amplitude tracks an action a user performs. |
| Screen | Event | Create an event to track screen views. |
| Page | Event | Browser SDK 2 tracks page views by default as [Amplitude] Page Viewed. Refer to Autocapture differences. |
| Group | Group | A group is a collection of users. In Amplitude, one user can belong to multiple groups. Each group can have properties that you can query or forward when any user in the group performs an action. |
| Alias | None | Amplitude automatically merges anonymous activity with the known user. Refer to Alias. |
| Plugins | Plugins | Plugins extend Amplitude by running custom code on every event. |
Documentation for Browser 2 SDK.
Identify
Segment
analytics.identify("12091906-01011992", {
name: "Grace Hopper",
email: "grace@usnavy.gov",
});
Amplitude
amplitude.setUserId("12091906-01011992");
amplitude.identify(
new amplitude.Identify()
.set("name", "Grace Hopper")
.set("email", "grace@usnavy.gov"),
);
Track
Segment
analytics.track("Article Completed", {
title: "How to Create a Tracking Plan",
course: "Intro to Analytics",
});
Amplitude
amplitude.track("Article Completed", {
title: "How to Create a Tracking Plan",
course: "Intro to Analytics",
});
Page
Segment
analytics.page("Pricing");
Amplitude
Browser SDK 2 tracks page views by default, so you can remove page() calls. To track a named page view yourself, turn off autocapture.pageViews and send an event:
amplitude.track("Page Viewed", { name: "Pricing" });
Group
Segment
analytics.group("UNIVAC Working Group", {
principles: ["Eckert", "Mauchly"],
site: "Eckert–Mauchly Computer Corporation",
statedGoals: "Develop the first commercial computer",
industry: "Technology",
});
Amplitude
Assign user to a group:
amplitude.setGroup("Working Group", "UNIVAC");
Update properties of a group:
amplitude.groupIdentify(
"Working Group",
"UNIVAC",
new amplitude.Identify()
.set("principles", ["Eckert", "Mauchly"])
.set("site", "Eckert–Mauchly Computer Corporation")
.set("statedGoals", "Develop the first commercial computer")
.set("industry", "Technology"),
);
For all other SDKs, refer to the relevant SDK documentation.
Alias
Segment uses alias() to link an anonymous ID to a known user ID. Amplitude doesn't need a separate alias call. When you call setUserId(), Amplitude merges the anonymous events from the current device ID with that user ID. For details, refer to Track unique users.
Amplitude doesn't merge two different user IDs automatically. To map one user ID to another across projects, use the User Mapping (Aliasing) API, which requires the Portfolio add-on.
Minimum ID length
Amplitude requires user IDs and device IDs to have at least 5 characters. If an ID is shorter, Amplitude removes it from the event. If the event then has neither a user ID nor a device ID, Amplitude can reject it. Segment has no minimum ID length, so check for short IDs such as numeric database keys ("42") before you migrate.
To accept shorter IDs, either:
- Set the
minIdLengthoption when you initialize Browser SDK 2. - Pass
min_id_lengthin the request options for the HTTP V2 API.
Autocapture differences
Segment's Analytics.js sends only the calls you write, plus one page() call in the default snippet. Browser SDK 2 captures some events by default, so remove your own calls for the same interactions to avoid duplicates. With the default configuration, Browser SDK 2 captures:
- Page views
- Sessions (start and end)
- Marketing attribution
- Form interactions (start and submit)
- File downloads
- Page URL properties on every event
Element clicks, frustration interactions (such as rage clicks), web vitals, and network requests are off by default. For all autocapture options, refer to Autocapture.
Validate events
Data validation is a critical step in instrumentation. Validate your event data using Amplitude's debugging tools.
Add a destination
To add a new destination:
- In Data, click Destinations in the Connections section.
- Click Add Destination.
- Browse or search for the destination you want to add.
- Follow the on-screen prompts.
For detailed instructions, refer to the documentation for the destination you want to add.
Migration checklist
Validate the migration to minimize impact on downstream data consumers.
- [x] Added all sources to Amplitude
- [x] Migrated existing tracking code to Amplitude SDKs
- [x] Validated events are flowing in to Amplitude correctly
- [x] Added all destinations to Amplitude
- [x] Validated data is flowing into destinations correctly
- [x] Validated downstream consumers aren't affected (for example, BI, Mktg, ML, Ops)
Frequently asked questions
Was this helpful?
For AI agents: a documentation index is available at /docs/llms.txt. Append .md to any page URL for markdown, or send Accept: text/markdown.