---
title: "Record analytics event"
method: POST
path: "/_temps/event"
tags: ["Metrics"]
---

# Record analytics event

`POST /_temps/event`

## Request

- Base URL: `/api` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/_temps/event`
- Auth: none declared

## Query parameters

- `temps_key` string

## Headers

- `x-temps-analytics-key` string, nullable

## Request body

- EventMetricsPayload
  - `cls` number, float, nullable: Cumulative Layout Shift (score)
  - `domain` string, nullable: The tracked site's own domain, computed client-side by the SDK's `resolveDomain()` and sent as a sibling of `event_data` (not nested inside it). Used on the keyed ingest path (ADR-040 §3) to attribute self-referrals/channels correctly: there, `Host` names the Temps server rather than the customer's site, so it can't be used for that.
  - `event_data` unknown, required
  - `event_name` string, required
  - `fcp` number, float, nullable: First Contentful Paint (milliseconds)
  - `fid` number, float, nullable: First Input Delay (milliseconds)
  - `inp` number, float, nullable: Interaction to Next Paint (milliseconds)
  - `language` string, nullable
  - `lcp` number, float, nullable: Largest Contentful Paint (milliseconds)
  - `page_title` string, nullable
  - `referrer` string, nullable: Referrer URL (falls back to Referer header if not provided)
  - `request_path` string, required
  - `request_query` string, required
  - `screen_height` integer, nullable
  - `screen_width` integer, nullable
  - `session_id` string, nullable: Client-generated session id fallback (see `visitor_id`).
  - `ttfb` number, float, nullable: Time to First Byte (milliseconds)
  - `viewport_height` integer, nullable
  - `viewport_width` integer, nullable
  - `visitor_id` string, nullable: Client-generated visitor id, used only when the request carries no Temps-issued `_temps_visitor_id` cookie — i.e. Temps is used purely as an analytics backend for an app it doesn't deploy/proxy (gotempsh/temps#848). Accepts the SDK's `visitorId` key too, since the shared SDK helper that generates this value sends camelCase for every ingest endpoint.

## Response `204`

Event recorded successfully

## Other responses

- `400`: Bad request
- `500`: Internal server error

## Changes

- **2026-09-07** `c2a1f69745e7`: 5 info
  - added the new optional `header` request parameter `x-temps-analytics-key`
  - added the new optional `query` request parameter `temps_key`
  - added the new optional request property `domain`
  - added the new optional request property `session_id`
  - …1 more
- **2026-09-07** `7a3103561bd0`: 5 warning
  - deleted the `header` request parameter `x-temps-analytics-key`
  - deleted the `query` request parameter `temps_key`
  - removed the request property `domain`
  - removed the request property `session_id`
  - …1 more
- **2026-09-07** `7fcff272f099`: 5 info
  - added the new optional `header` request parameter `x-temps-analytics-key`
  - added the new optional `query` request parameter `temps_key`
  - added the new optional request property `domain`
  - added the new optional request property `session_id`
  - …1 more
- **2026-09-07** `c1fa498b6377`: 5 warning
  - deleted the `header` request parameter `x-temps-analytics-key`
  - deleted the `query` request parameter `temps_key`
  - removed the request property `domain`
  - removed the request property `session_id`
  - …1 more
- **2026-09-07** `c43de0e360be`: 5 info
  - added the new optional `header` request parameter `x-temps-analytics-key`
  - added the new optional `query` request parameter `temps_key`
  - added the new optional request property `domain`
  - added the new optional request property `session_id`
  - …1 more

[Operation history](https://skmtc.dev/gotempsh/apis/temps/changes/_temps/event/post.md)

---

[API](https://skmtc.dev/gotempsh/apis/temps.md) - [All operations](https://skmtc.dev/gotempsh/apis/temps/llms.txt) - [OpenAPI document](https://skmtc.dev/gotempsh/apis/temps/revisions/3b040526eb43?raw)
