
Amplitude handles both [Analytics](https://amplitude.com/amplitude-analytics) and [CDP](https://amplitude.com/customer-data-platform) needs. This document covers how to:

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.

| Segment                                                 | Amplitude                                                                             |
| ------------------------------------------------------- | ------------------------------------------------------------------------------------- |
| [Connections](https://segment.com/product/connections/) | [Sources](/docs/data/source-catalog) & [Destinations](/docs/data/destination-catalog) |
| [Profiles](https://segment.com/product/profiles/)       | [Predictive analytics](/docs/analytics/predictive/predictive-analytics)               |
| [Protocols](https://segment.com/product/protocols/)     | [Data Management](/docs/data)                                                         |

{% callout type="info" heading="Recommended best practice" %}
Follow a strict release process and [configure multiple environments](/docs/data/amplitude-data-settings). Validate changes within each environment before deploying.
{% /callout %}

## Add a source

To add a [new source](/docs/data/source-catalog):

1. From 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](/docs/data/source-catalog) 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](/docs/admin/account-management/manage-orgs-projects) organize your data.                                                                                                                 |
| User      | User      | The user performing the action.                                                                                                                                                                     |
| Identify  | Identify  | Identify updates user properties.                                                                                                                                                                   |
| Track     | Event     | An [event](/docs/apis/analytics/http-v2/) in Amplitude tracks an action a user performs.                                                                                                            |
| Screen    | Event     | Create an event to track screen views.                                                                                                                                                              |
| Page      | Event     | Create an event to track page views.                                                                                                                                                                |
| 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. |
| Plugins   | Plugins   | Plugins extend Amplitude by running custom code on every event.                                                                                                                                     |

{% tabs tabs="Browser, iOS, Android" %}
{% tab name="Browser" %}
Documentation for [Browser 2 SDK](/docs/sdks/analytics/browser/browser-sdk-2).

### Identify

#### Segment

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

#### Amplitude

```typescript
setUserId("12091906-01011992");
identify(
  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
track("Article Completed", {
  title: "How to Create a Tracking Plan",
  course: "Intro to Analytics",
});
```

### 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
groupIdentify(
  'Working Group',
  'UNIVAC' ,
  new Identify()
    .set('principles', ['Eckert', 'Mauchly']);
    .set('site', 'Eckert–Mauchly Computer Corporation');
    .set('statedGoals', 'Develop the first commercial computer');
    .set('industry', 'Technology')
);
```

{% /tab %}
{% tab name="iOS" %}
Documentation for [iOS Swift SDK](/docs/sdks/analytics/ios/ios-swift-sdk).

### Identify

#### Segment

```swift
Analytics.shared().identify("abc", traits: ["email": "abc@domain.com"])
```

#### Amplitude

```swift
Amplitude.instance().setUserId("abc")
Amplitude.instance().identify(
  AMPIdentify()
    .set("email", value: "female")
    .set("age",value: NSNumber(value: 20))
)
```

### Track

#### Segment

```swift
Analytics.shared().track("Button Clicked", properties: ["Hover Time": "100ms"])
```

#### Amplitude

```swift
Amplitude.instance().logEvent("Button Clicked", withEventProperties: ["Hover Time": "100ms"] )
```

#### Group

#### Segment

```swift
Analytics.shared().group("OrgName-xyz", traits: ["plan": "enterprise"])
```

#### Amplitude

Assign user to a group:

```swift
Amplitude.instance().setGroup("orgName", groupName:NSString(string:"xyz"))
```

Update properties of a group:

```swift
Amplitude.instance().groupIdentifyWithGroupType(
  "orgName",
  groupName:NSString(string:"xyz"),
  groupIdentify:AMPIdentify().set("plan", value: "enterprise")
)
```

{% /tab %}
{% tab name="Android" %}
Documentation for [Android Kotlin SDK](/docs/sdks/analytics/android/android-kotlin-sdk).

### Identify

#### Segment

```kotlin
Analytics.with(context).identify("abc", Traits().putEmail("abc@domain.com"), null)
```

#### Amplitude

```kotlin
amplitude.setUserId("abc")
amplitude.identify(Identify().set("email", "abc@domain.com"))
```

### Track

#### Segment

```kotlin
Analytics.with(context).track("Product Viewed", Properties().putValue("name", "Moto 360"))
```

#### Amplitude

```kotlin
amplitude.track(
  "Product Viewed",
  mutableMapOf<String, Any?>("name" to "Moto 360")
)
```

### Group

#### Segment

```kotlin
Analytics.with(context).group("abc", "orgName-xyz", Traits().putplan("enterprise"))
```

#### Amplitude

Assign user to a group:

```kotlin
amplitude.setGroup("orgName", "xyz");
```

Update properties of a group:

```kotlin
amplitude.groupIdentify("orgName", "xyz", Identify().set("plan", "enterprise"))
```

{% /tab %}
{% /tabs %}

For all other SDKs, refer to the relevant [SDK documentation](/docs/sdks/analytics).

## Validate events

Data validation is a critical step in instrumentation. Validate your event data using Amplitude's debugging [tools](/docs/analytics/debug-analytics).

## Add a destination

To add a [new destination](/docs/data/destination-catalog):

1. From 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](/docs/data/destination-catalog) 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

{% accordion title="How long does it take to migrate?" %}
Migration time depends on how you implemented your CDP. Most teams should plan a few months to complete the migration. Updating your taxonomy and tracking plan can require more upfront planning.
{% /accordion %}

{% accordion title="What if I don't see an integration that I need?" %}
Amplitude regularly adds new integrations. Add a request in-product or ask your CSM for a timeline.
{% /accordion %}

{% accordion title="What if I have an existing CDP contract?" %}
Contact your CSM or AE to discuss available options.
{% /accordion %}
