> AI agents: this is one page of nextanalytica's docs. The full index for agents: https://nextanalytica.app/llms.txt

# Segment and RudderStack

> Forward your CDP's calls from Segment or RudderStack, so the user ids it already knows join your people and an alias merges two profiles into one.

Updated: 2026-11-18

A customer data platform (CDP), such as Segment or RudderStack, already knows who your users are: it sends `identify` when they sign in and `alias` when an account changes. Forward its calls to nextanalytica, and those user ids join your people, so your agent reads one person where it would see several.

This works next to the tag, not instead of it: the tag counts visits, and your CDP adds the ids and events only it has.

## What do you need?

- **A server key.** An owner or admin opens **Tracking** and, under **Keys**, clicks **Make one** (or **New key**) next to **Server key**. It's shown once, so copy it then. It's the same key your servers use for server events; a new key stops the old one at once, everywhere.
- **The address:** `https://t.nextanalytica.app/cdp`.

> **Warning:** The server key writes to your project. Keep it in your CDP's settings and on your servers, never in a page.

## Set up Segment

1. In Segment, add the **Webhooks (Actions)** destination to the source you want to forward.
2. Add a mapping with the **Send** action, for the calls you want: Identify, Track, Page, Group and Alias.
3. Set **URL** to `https://t.nextanalytica.app/cdp` and **Method** to `POST`.
4. Under **Headers**, add `Authorization` with the value `Bearer nask_…`, your server key.
5. Send the whole event as **Data**, as Segment writes it.
6. Turn the destination on.

Batching can stay on: one request takes up to **1,000** calls and **4 MB**.

## Set up RudderStack

1. In RudderStack, add the **Webhook** destination and connect your source.
2. Set the URL to `https://t.nextanalytica.app/cdp` and the method to `POST`.
3. Add the header `Authorization` with the value `Bearer nask_…`, your server key.
4. Send the event payload as it is.

> **Tip:** A tool that takes a write key as Basic auth works too: give the server key as the user name and leave the password empty.

## What does each call become?

Each call becomes one event of the person it names: `userId` when it has one, else `anonymousId`.

| Call | Becomes | What's kept |
| --- | --- | --- |
| `identify` with a `userId` | The `anonymousId` is linked to the `userId`: that person's earlier events become the signed-in person's | Up to **20** traits, as person properties |
| `identify` with an `anonymousId` only | That person's properties change | Up to **20** traits |
| `track` | A custom event, named as the call's `event` | Up to **10** properties; `revenue` or `value`, with `currency`, as the event's value |
| `track` named `Order Completed` | An order | `order_id`, `revenue` (or `total`) and `currency` |
| `page` | A page view of the person | The path without its query, the host and the title |
| `group` | The person joins a group of type `company`, keyed by `groupId` | Up to **20** traits, as the group's properties |
| `alias` | The `previousId` is merged into the `userId`: two people become one | Nothing more |

Properties and traits are kept as text: words, numbers and true or false. Nested objects and lists are left out, and each value is cut at **500** characters.

Other calls, such as `screen`, and calls with no id are skipped; the rest of the request is kept. The answer says how many of each: `{"accepted":6,"skipped":1}`.

## How do the CDP's ids meet the tag's?

Through your user id. Segment's `anonymousId` isn't the tag's visitor id, so an anonymous visitor seen by both is two people until they sign in. Call `identify` in the tag with the same user id your CDP sends, and both histories become one person. See [Identify people](/docs/tracking/identify-people).

`alias` merges two people even when both had signed in: the `userId` survives with every id the `previousId` had.

## Do these events count as visits?

No. Like server events, each call is an event of its person that belongs to no visit, so nothing is counted twice when the tag runs too. Orders and conversions from your CDP count under the channel "Server". Visits, pages and channels still come from the tag.

## How is consent handled?

Every call your CDP forwards counts as consented: your CDP is where consent is decided, as on your own servers. Set up your CDP's consent settings so calls from people who said no never reach this destination.

Do Not Track and Global Privacy Control aren't checked for these calls, because they come from your CDP, not from a browser.

## What is never kept?

- **IP addresses.** `context.ip` is ignored, and the request's own address is your CDP's, never stored.
- **The rest of `context`:** the user agent, the location, the device and the library.
- **Query strings.** A page's path loses its query, and emails, tokens, card-like numbers and phone numbers in the path are replaced.

Traits are your data: a trait that is an email address is kept as a person property. Other text, in traits, properties and titles, loses emails, tokens, card-like numbers and phone numbers. Never send passwords.

## What time does an event get?

The call's `timestamp`, else `originalTimestamp` or `sentAt`. A time more than a day from now gets the time it arrived instead, so this isn't a way to import old history.

A call your CDP retries, with the same `messageId` and `timestamp`, counts once.

## What do the answers mean?

| Status | Meaning |
| --- | --- |
| `200` | Taken. The body says how many calls were accepted and skipped. |
| `400` | Not JSON, or no calls, or more than **1,000** in one request. |
| `401` | The `Authorization` header is missing, or the server key is unknown. Make a new one in **Tracking**. |
| `413` | The request is over **4 MB**. Turn the batch size down. |
| `429` | Too many requests for one project: over **3,000** in 10 seconds. Your CDP retries. |

## Next steps

- [Identify people](/docs/tracking/identify-people): the tag's side of the same person.
- [Custom events](/docs/tracking/custom-events): events and orders from the page.
- [Cookieless counting and consent](/docs/tracking/cookieless-and-consent): what the tag keeps before and after consent.

Canonical address: https://nextanalytica.app/docs/tracking/segment-and-rudderstack
