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:

  1. Migrate your source and destination configuration.
  2. Update your SDK implementation to send data to Amplitude.
  3. 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:

  1. In Data, click Sources in the Connections section.
  2. Click Add Source.
  3. Browse or search for the source you want to add.
  4. 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.

Documentation for Browser 2 SDK.

Identify

Segment

typescript
analytics.identify("12091906-01011992", {
  name: "Grace Hopper",
  email: "grace@usnavy.gov",
});

Amplitude

typescript
amplitude.setUserId("12091906-01011992");
amplitude.identify(
  new amplitude.Identify()
    .set("name", "Grace Hopper")
    .set("email", "grace@usnavy.gov"),
);

Track

Segment

typescript
analytics.track("Article Completed", {
  title: "How to Create a Tracking Plan",
  course: "Intro to Analytics",
});

Amplitude

typescript
amplitude.track("Article Completed", {
  title: "How to Create a Tracking Plan",
  course: "Intro to Analytics",
});

Page

Segment

typescript
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:

typescript
amplitude.track("Page Viewed", { name: "Pricing" });

Group

Segment

typescript
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:

typescript
amplitude.setGroup("Working Group", "UNIVAC");

Update properties of a group:

typescript
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 minIdLength option when you initialize Browser SDK 2.
  • Pass min_id_length in 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:

  1. In Data, click Destinations in the Connections section.
  2. Click Add Destination.
  3. Browse or search for the destination you want to add.
  4. 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.

On this page