Segment
BUILDING Source · built and tested, not yet verified against production accounts. Contact us before relying on it.
Overview
Section titled “Overview”Segment is a push source: instead of PortPilot reading an API, Segment sends your events to a PortPilot webhook URL. PortPilot stores each delivery as it arrives and, on every scheduled sync, loads the new events into your destination with one table per Segment call type (track, identify, page, screen, group, alias).
Available on PortPilot-hosted deployments only.
Features
Section titled “Features”| Feature | Supported | Notes |
|---|---|---|
| Incremental sync | Yes | Events received since the last sync. |
| Captures deletes | No | Records deleted in the source stay in the destination. |
| Custom fields | Yes | Your properties and traits, as JSON text. |
| Table selection | Yes | Choose which tables to sync. |
| New columns added automatically | Yes | Columns that appear in the source are added to the destination table. |
| Re-sync | Partly | Reloads only events received in the last 7 days. |
Before you connect
Section titled “Before you connect”- You need access to the Segment workspace, with permission to add a destination to the source whose events you want.
- Create the PortPilot connection first (below). It gives you the webhook URL and token you enter in Segment.
Connect
Section titled “Connect”- In the app, go to Connectors → New connector → Segment. There are no credentials to enter: click Test connection, then Continue, pick a destination and a sync frequency, and click Create & start initial sync.
- PortPilot shows a Webhook URL and an
Authorization: Bearer …header. Copy the token now. It isn’t shown again. - In Segment, add a Webhooks (Actions) destination to your source. Set the URL to the
webhook URL and add the
Authorizationheader with the bearer token. Batching may be enabled, up to 2,000 events or 2 MiB per request. - Send a test event from Segment. It appears in your destination after the next sync.
| Field | Required | Default | Description |
|---|---|---|---|
| — | — | — | Segment has no connection fields. PortPilot generates the webhook URL and token. |
Lost or leaked token? Generate a new one with
POST /api/v1/connections/<connection id>/webhook-token and update the header in Segment. The
old token stops working immediately.
Schema
Section titled “Schema”tracks
One row per `track` call (a user action).
| Column | Type | Description |
|---|---|---|
messageIdPK | string | Unique ID of the event; duplicates are merged on it. |
type | string | Call type, e.g. track. |
userId | string | Your ID for the user, if known. |
anonymousId | string | Device or browser ID for unidentified users. |
timestamp | string (datetime) | When the event happened. |
context | string | Device, library, page and campaign details, as JSON text. |
_received_atcursor | string (datetime) | When PortPilot received the event (the sync cursor). |
event | string | Event name, e.g. Order Completed. |
properties | string | Event properties, as JSON text. |
Main columns only. Other fields the source returns also land as columns.
identifies
One row per `identify` call.
| Column | Type | Description |
|---|---|---|
messageIdPK | string | Unique ID of the event; duplicates are merged on it. |
type | string | Call type, e.g. track. |
userId | string | Your ID for the user, if known. |
anonymousId | string | Device or browser ID for unidentified users. |
timestamp | string (datetime) | When the event happened. |
context | string | Device, library, page and campaign details, as JSON text. |
_received_atcursor | string (datetime) | When PortPilot received the event (the sync cursor). |
traits | string | User traits, as JSON text. |
Main columns only. Other fields the source returns also land as columns.
pages
One row per `page` call.
| Column | Type | Description |
|---|---|---|
messageIdPK | string | Unique ID of the event; duplicates are merged on it. |
type | string | Call type, e.g. track. |
userId | string | Your ID for the user, if known. |
anonymousId | string | Device or browser ID for unidentified users. |
timestamp | string (datetime) | When the event happened. |
context | string | Device, library, page and campaign details, as JSON text. |
_received_atcursor | string (datetime) | When PortPilot received the event (the sync cursor). |
name | string | Page name. |
properties | string | Page properties (URL, title, …), as JSON text. |
Main columns only. Other fields the source returns also land as columns.
screens
One row per `screen` call (mobile).
| Column | Type | Description |
|---|---|---|
messageIdPK | string | Unique ID of the event; duplicates are merged on it. |
type | string | Call type, e.g. track. |
userId | string | Your ID for the user, if known. |
anonymousId | string | Device or browser ID for unidentified users. |
timestamp | string (datetime) | When the event happened. |
context | string | Device, library, page and campaign details, as JSON text. |
_received_atcursor | string (datetime) | When PortPilot received the event (the sync cursor). |
name | string | Screen name. |
properties | string | Screen properties, as JSON text. |
Main columns only. Other fields the source returns also land as columns.
groups
One row per `group` call.
| Column | Type | Description |
|---|---|---|
messageIdPK | string | Unique ID of the event; duplicates are merged on it. |
type | string | Call type, e.g. track. |
userId | string | Your ID for the user, if known. |
anonymousId | string | Device or browser ID for unidentified users. |
timestamp | string (datetime) | When the event happened. |
context | string | Device, library, page and campaign details, as JSON text. |
_received_atcursor | string (datetime) | When PortPilot received the event (the sync cursor). |
groupId | string | ID of the account or group. |
traits | string | Group traits, as JSON text. |
Main columns only. Other fields the source returns also land as columns.
aliases
One row per `alias` call.
| Column | Type | Description |
|---|---|---|
messageIdPK | string | Unique ID of the event; duplicates are merged on it. |
type | string | Call type, e.g. track. |
userId | string | Your ID for the user, if known. |
anonymousId | string | Device or browser ID for unidentified users. |
timestamp | string (datetime) | When the event happened. |
context | string | Device, library, page and campaign details, as JSON text. |
_received_atcursor | string (datetime) | When PortPilot received the event (the sync cursor). |
previousId | string | The user's previous ID. |
Main columns only. Other fields the source returns also land as columns.
Every table shares the common fields. New top-level fields become new columns automatically.
Sync behavior
Section titled “Sync behavior”- Every sync is incremental: it loads the deliveries received since the previous sync and
upserts on
messageId, so events Segment delivers twice appear once. - Deliveries from the last two minutes are left for the next sync.
- PortPilot answers Segment only after a delivery is stored, so an acknowledged event is never lost before it’s synced.
Common gotchas
Section titled “Common gotchas”- Events are kept for 7 days before syncing. Keep the schedule at least daily, and don’t leave the connector paused or failing for a week, or older events are lost.
- A full re-sync only reloads what’s still stored (the last 7 days). It adds to your tables and never replaces them, so history from before then stays as loaded.
- Large batches are rejected. Requests over 2 MiB or 2,000 events get an error; lower the batch size in the Webhooks (Actions) destination.
- Wrong or missing token returns 401. Check the
Authorizationheader isBearer <token>with no extra spaces, and that the token hasn’t been rotated. - Hosted only. Bring-your-own-cloud deployments can’t receive Segment events yet.