---
title: Migrating from Segment to Chord CDP
slug: migrating-from-segment-to-chord-cdp
docTags: 
createdAt: 2025-04-03T19:58:54.902Z
---

:::hint{type="info"}
The only difference between using Chord's SDKs to send events to Chord CDP vs Segment is *where the events are sent*. **The events will remain exactly the same.** As a result, only small configuration changes are needed.  Easy!
:::

## Client-side / front-end events

### Chord Analytics library

If you're using the `@chordcommerce/analytics` library on a headless site, your current implementation might look something like this:

```javascript
import { ChordAnalytics } from '@chordcommerce/analytics'
import { AnalyticsBrowser } from '@segment/analytics-next'

const cdp = AnalyticsBrowser.load({
  writeKey: process.env.SEGMENT_WRITE_KEY,
})
const chord = new ChordAnalytics({
  cdp,
  formatters: { ... },
  metadata: { ... },
})

// Example events
chord.page()
chord.trackProductAdded({ ... })
```

In that case, migrating to Chord CDP will involve:

1. updating `@chordcommerce/analytics` to version `1.9.1` or greater
2. removing the `@segment/analytics-next` dependency
3. removing initialization of the `cdp` variable and configuration option
4. using `cdpDomain` and `cdpWriteKey` configuration options - both to be provided by Chord - instead
5. using the `consent` configuration option for built-in consent management support (optional)

The resulting code will look something like this:

```javascript
import { ChordAnalytics } from '@chordcommerce/analytics'

const chord = new ChordAnalytics({
  cdpDomain: process.env.CHORD_CDP_DOMAIN,
  cdpWriteKey: process.env.CHORD_CDP_WRITE_KEY,
  consent: 'shopify', // optional
  formatters: { ... },
  metadata: { ... },
})

// Example events (unchanged)
chord.page()
chord.trackProductAdded({ ... })
```

**Running both in parallel**

It is possible to send every event to both Chord CDP *and* Segment at the same time. This is useful for running a side-by-side comparison of event data during migration. It also buys more time when migrating destinations.

The resulting code would be a combination of the two examples above; for example:

```javascript
import { ChordAnalytics } from '@chordcommerce/analytics'
import { AnalyticsBrowser } from '@segment/analytics-next'

const cdp = AnalyticsBrowser.load({
  writeKey: process.env.SEGMENT_WRITE_KEY,
})
const chord = new ChordAnalytics({
  cdp,
  cdpDomain: process.env.CHORD_CDP_DOMAIN,
  cdpWriteKey: process.env.CHORD_CDP_WRITE_KEY,
  formatters: { ... },
  metadata: { ... },
})

// Example events (unchanged)
chord.page()
chord.trackProductAdded({ ... })
```

Once the validation and migration are complete, the Segment code can be safely removed to match the second example.

### Shopify web pixel

If you're using Chord's Shopify web pixel - either for a fully Liquid site or just for Checkout Extensibility - we will provide an updated web pixel that supports Chord CDP.

### Chord OMS SDKs

If your storefront is built on Chord OMS using the Gatsby or Next.js starterkits, the Chord team will help you swap the Segment snippet for the Chord CDP snippet.

## Server-side / back-end events

Regardless of OMS, Chord will assist in the migration of server-side/back-end events. It will be an equally simple process, but the actual implementation will vary based on the current architecture.
