EventRail
Docs menu

EventRecord

The row every destination writes: one per event, with the same fields for every event. This page lists each field and who sets it, and shows example records.

Fields

FieldSet byWhat it holds
specVersionHubThe version of the record shape, from the Hub that assembled the record.
idProducerA UUID minted by the producer for this event.
sessionIdHub, from the requestThe visitor's session identifier, or null when the storage policy stored none.
nameProducerThe event name, as passed to track().
locationProducerThe page URL in the browser; the Referer header on the server.
occurredAtProducer's clockWhen track() was called.
sentAtProducer's clockWhen the event was handed to the Hub.
receivedAtHub's clockWhen the Hub received the event.
producerTypeHub"remote" for events that came in over HTTP through the collector, "local" for events from a server producer.
producerNameProducerNames the source stream, e.g. "browser". A claim from a remote producer; your own configuration on a local one.
producerPropertiesProducerThe track() properties merged over the producer's properties(). JSON you define.
hubPropertiesHubThe request values the Hub collects (userAgent, forwardedFor, acceptLanguage) merged under your hubProperties(). forwardedFor is the raw X-Forwarded-For header. JSON you define.
consentHub, from the requestThe visitor's decision when the event arrived: "accepted", "denied" or "unset".

In TypeScript, a record has the EventRecord type from @eventrail/nextjs/core.

Examples

Records as a destination receives them. The browser and server events come from the same visit, so they share a sessionId. In each, userId comes from a hubProperties() function like the one in Server-resolved user IDs.

Browser event

{
  specVersion: 1,
  id: "1f2a9c3e-6b8d-4f1a-9e2c-7d4b5a6f8e10",
  sessionId: "9d2c7e4b-1f8a-4c3d-8e2b-7a6f5e4d3c2b",
  name: "upgrade_plan_button_clicked",
  location: "https://yourapp.com/pricing",
  occurredAt: "2026-09-23T12:00:00.081Z",
  sentAt: "2026-09-23T12:00:00.092Z",
  receivedAt: "2026-09-23T12:00:00.140Z",
  producerType: "remote",Came in over HTTP, through the collector.
  producerName: "browser",
  producerProperties: { plan: "pro" },
  hubProperties: {
    userAgent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36",
    forwardedFor: "203.0.113.7",
    acceptLanguage: "en-US,en;q=0.9",
    userId: "usr_42"
  },
  consent: "accepted"
}

Relating events

  • Link events by sessionId. Browser events and server events fired during the same visitor's request carry the same identifier.
  • Without a sessionId, relate events by request values. Events with a null sessionId can still be grouped into approximate visits by IP address, user agent and language. See Relating events without a sessionId.
  • Deduplicate on id. The same event written twice has the same id. The Postgres table has no unique constraint on it, and BigQuery's deduplication on it is best-effort.
  • Order on receivedAt. It comes from your server's clock. occurredAt and sentAt come from the producer's clock, which on a visitor's device can be wrong.