Segment
Track events and manage customer data with Segment CDP
Integrate Segment Customer Data Platform into your workflow. Track user events and behaviors, identify users with traits, record page views, associate users with companies or groups, and send batch events to sync data across all your marketing and analytics tools from a single source of truth.
Track a custom event in Segment for a user or anonymous visitor
| Parameter | Type | Required | Description |
|---|
writeKey | string | No | Segment source write key |
event | string | No | Name of the event to track (e.g. "Order Completed") |
userId | string | No | Unique identifier for the user |
anonymousId | string | No | Anonymous identifier (required if userId not provided) |
properties | json | No | Event properties as JSON object |
context | json | No | Context information as JSON object (ip, locale, page, etc.) |
timestamp | string | No | ISO 8601 timestamp of the event |
integrations | json | No | Control which integrations receive the event as JSON object |
| Parameter | Type | Description |
|---|
success | boolean | Whether the event was tracked successfully |
event | string | Name of the tracked event |
userId | string | User ID associated with the event |
anonymousId | string | Anonymous ID associated with the event |
Identify a user and set their traits in Segment
| Parameter | Type | Required | Description |
|---|
writeKey | string | No | Segment source write key |
userId | string | No | Unique identifier for the user |
anonymousId | string | No | Anonymous identifier (required if userId not provided) |
traits | json | No | User traits as JSON object (name, email, plan, etc.) |
context | json | No | Context information as JSON object |
timestamp | string | No | ISO 8601 timestamp |
| Parameter | Type | Description |
|---|
success | boolean | Whether the identify call was successful |
userId | string | User ID that was identified |
anonymousId | string | Anonymous ID that was identified |
Record a page view in Segment
| Parameter | Type | Required | Description |
|---|
writeKey | string | No | Segment source write key |
userId | string | No | Unique identifier for the user |
anonymousId | string | No | Anonymous identifier (required if userId not provided) |
name | string | No | Name of the page (e.g. "Home", "Product Detail") |
category | string | No | Category of the page |
properties | json | No | Page properties as JSON object (url, title, referrer, etc.) |
context | json | No | Context information as JSON object |
timestamp | string | No | ISO 8601 timestamp |
| Parameter | Type | Description |
|---|
success | boolean | Whether the page view was recorded successfully |
name | string | Name of the page |
userId | string | User ID associated with the page view |
anonymousId | string | Anonymous ID associated with the page view |
Associate a user with a group or account in Segment
| Parameter | Type | Required | Description |
|---|
writeKey | string | No | Segment source write key |
groupId | string | No | Unique identifier for the group or account |
userId | string | No | Unique identifier for the user |
anonymousId | string | No | Anonymous identifier (required if userId not provided) |
traits | json | No | Group traits as JSON object (name, industry, plan, etc.) |
context | json | No | Context information as JSON object |
timestamp | string | No | ISO 8601 timestamp |
| Parameter | Type | Description |
|---|
success | boolean | Whether the group association was successful |
groupId | string | Group ID that was associated |
userId | string | User ID that was associated |
anonymousId | string | Anonymous ID that was associated |
Create an alias between a new userId and a previous anonymous or userId in Segment
| Parameter | Type | Required | Description |
|---|
writeKey | string | No | Segment source write key |
userId | string | No | The new canonical user ID to merge into |
previousId | string | No | Previous ID (anonymous ID or old user ID) to alias from |
context | json | No | Context information as JSON object |
timestamp | string | No | ISO 8601 timestamp |
| Parameter | Type | Description |
|---|
success | boolean | Whether the alias was created successfully |
userId | string | New canonical user ID |
previousId | string | Previous ID that was aliased |
Send multiple Segment events (track, identify, page, group) in a single batch request
| Parameter | Type | Required | Description |
|---|
writeKey | string | No | Segment source write key |
batch | json | No | Array of Segment event objects (each with type, userId/anonymousId, and event data) |
context | json | No | Global context applied to all events in the batch |
| Parameter | Type | Description |
|---|
success | boolean | Whether the batch was sent successfully |
count | number | Number of events sent in the batch |