Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(ingestion): warn when cookieless events are dropped because the team setting is off (#99225)

Paweł Ledwońf51883fc1993
diff --git a/frontend/src/scenes/data-management/ingestion-warnings/IngestionWarningsView.tsx b/frontend/src/scenes/data-management/ingestion-warnings/IngestionWarningsView.tsx
index c6dc0e71d0a5..486345550c30 100644
--- a/frontend/src/scenes/data-management/ingestion-warnings/IngestionWarningsView.tsx
+++ b/frontend/src/scenes/data-management/ingestion-warnings/IngestionWarningsView.tsx
@@ -41,6 +41,7 @@ export const WARNING_TYPE_TO_DESCRIPTION: Record<string, string> = {
schema_validation_failed: 'Event rejected due to schema validation failure',
invalid_heatmap_data: 'Invalid heatmap data',
invalid_group_set: 'Discarded a $groupidentify event whose $group_set is not an object',
+ cookieless_team_disabled: 'Discarded cookieless event because cookieless tracking is disabled',
// Emitted by the capture service when it drops events at validation time
missing_event_name: 'Discarded event with no event name',
event_name_too_long: 'Discarded event whose name exceeds the length limit',
@@ -86,6 +87,7 @@ export const WARNING_TYPE_TO_DOCS_ANCHOR: Record<string, string> = {
set_on_exception: 'invalid-set-operations-on-exception-events',
invalid_heatmap_data: 'invalid-heatmap-data',
high_volume_distinct_id: 'skipped-person-profile-processing-for-a-high-volume-distinct-id',
+ cookieless_team_disabled: 'discarded-cookieless-event-because-cookieless-tracking-is-disabled',
}
export const WARNING_TYPE_RENDERER = {
@@ -341,6 +343,24 @@ export const WARNING_TYPE_RENDERER = {
</>
)
},
+ cookieless_team_disabled: function Render(warning: IngestionWarning): JSX.Element {
+ const details = warning.details as {
+ eventUuid: string
+ event: string
+ distinctId: string
+ }
+ return (
+ <>
+ Discarded a <code>{details.event}</code> event sent in cookieless mode (event uuid:{' '}
+ <code>{details.eventUuid}</code>) because cookieless tracking is disabled for this project. Enable it
+ under{' '}
+ <Link to={urls.settings('environment-web-analytics', 'cookieless-server-hash-mode')}>
+ Settings → Web analytics → Cookieless tracking
+ </Link>
+ , or remove <code>cookieless_mode</code> from your posthog-js config.
+ </>
+ )
+ },
schema_validation_failed: function Render(warning: IngestionWarning): JSX.Element {
const details = warning.details as {
eventUuid: string
diff --git a/nodejs/src/ingestion/common/cookieless/cookieless-manager.test.ts b/nodejs/src/ingestion/common/cookieless/cookieless-manager.test.ts
index 68cbbf1ec5f7..975cb6cf8675 100644
--- a/nodejs/src/ingestion/common/cookieless/cookieless-manager.test.ts
+++ b/nodejs/src/ingestion/common/cookieless/cookieless-manager.test.ts
@@ -802,6 +802,32 @@ describe('CookielessManager', () => {
const actual1 = await processEvent(nonCookielessEvent)
expect(actual1).toBe(nonCookielessEvent)
})
+ it('should emit an ingestion warning for each dropped cookieless event', async () => {
+ const response = await infra.cookielessManager.doBatch([
+ { event, team, message, headers: createTestEventHeaders() },
+ { event: nonCookielessEvent, team, message, headers: createTestEventHeaders() },
+ ])
+ expect(response.length).toBe(2)
+
+ const droppedResult = response[0]
+ expect(droppedResult.type).toBe(PipelineResultType.DROP)
+ if (droppedResult.type === PipelineResultType.DROP) {
+ expect(droppedResult.reason).toBe('cookieless_team_disabled')
+ }
+ expect(droppedResult.warnings).toHaveLength(1)
+ expect(droppedResult.warnings[0]).toMatchObject({
+ type: 'cookieless_team_disabled',
+ details: {
+ eventUuid: event.uuid,
+ event: event.event,
+ distinctId: event.distinct_id,
+ },
+ })
+
+ const passThroughResult = response[1]
+ expect(passThroughResult.type).toBe(PipelineResultType.OK)
+ expect(passThroughResult.warnings).toHaveLength(0)
+ })
it('should not return dropped cookieless events but should not throw', async () => {
const testHeaders = createTestEventHeaders({
token: 'test-token',
diff --git a/nodejs/src/ingestion/common/cookieless/cookieless-manager.ts b/nodejs/src/ingestion/common/cookieless/cookieless-manager.ts
index 08c27d198f42..f38234d953f1 100644
--- a/nodejs/src/ingestion/common/cookieless/cookieless-manager.ts
+++ b/nodejs/src/ingestion/common/cookieless/cookieless-manager.ts
@@ -354,7 +354,20 @@ export class CookielessManager {
team.cookieless_server_hash_mode === CookielessServerHashMode.Disabled
) {
// if the specific team doesn't have cookieless enabled, drop the event
- results[i] = drop('cookieless_team_disabled')
+ results[i] = drop(
+ 'cookieless_team_disabled',
+ [],
+ [
+ {
+ type: 'cookieless_team_disabled',
+ details: {
+ eventUuid: event.uuid,
+ event: event.event,
+ distinctId: event.distinct_id,
+ },
+ },
+ ]
+ )
continue
}
diff --git a/nodejs/src/ingestion/common/ingestion-warning-types.ts b/nodejs/src/ingestion/common/ingestion-warning-types.ts
index b53a84cc7627..8d9b2f77c827 100644
--- a/nodejs/src/ingestion/common/ingestion-warning-types.ts
+++ b/nodejs/src/ingestion/common/ingestion-warning-types.ts
@@ -89,7 +89,7 @@ export const INGESTION_WARNING_TYPES = {
invalid_event_when_process_person_profile_is_false: { category: 'event', severity: 'error' },
event_dropped_too_old: { category: 'event', severity: 'info' },
- // Cookieless mode — events missing the data required to compute a cookieless distinct id
+ cookieless_team_disabled: { category: 'event', severity: 'error' },
cookieless_missing_timestamp: { category: 'event', severity: 'error' },
cookieless_timestamp_out_of_range: { category: 'event', severity: 'error' },
cookieless_missing_user_agent: { category: 'event', severity: 'error' },
diff --git a/nodejs/src/ingestion/ingestion-consumer.serial.test.ts b/nodejs/src/ingestion/ingestion-consumer.serial.test.ts
index 623f2cb120ca..0059f4f9b0f6 100644
--- a/nodejs/src/ingestion/ingestion-consumer.serial.test.ts
+++ b/nodejs/src/ingestion/ingestion-consumer.serial.test.ts
@@ -239,7 +239,16 @@ describe('IngestionConsumer', () => {
)
await ingester.handleKafkaBatch(createKafkaMessages([createCookielessEvent()]))
- expect(mockProducerObserver.getProducedKafkaMessages()).toHaveLength(0)
+ expect(mockProducerObserver.getProducedKafkaMessagesForTopic('clickhouse_events_json_test')).toHaveLength(0)
+ const warningMessages = mockProducerObserver.getProducedKafkaMessagesForTopic(
+ 'clickhouse_ingestion_warnings_test'
+ )
+ expect(warningMessages).toHaveLength(1)
+ expect(warningMessages[0].value).toMatchObject({
+ team_id: team.id,
+ type: 'cookieless_team_disabled',
+ })
+ expect(mockProducerObserver.getProducedKafkaMessages()).toHaveLength(1)
})
it('should not blend person properties from 2 different cookieless users', async () => {
diff --git a/products/ingestion/skills/resolving-ingestion-warnings/SKILL.md b/products/ingestion/skills/resolving-ingestion-warnings/SKILL.md
index 7f6f3c0d1016..97b3ff4f1370 100644
--- a/products/ingestion/skills/resolving-ingestion-warnings/SKILL.md
+++ b/products/ingestion/skills/resolving-ingestion-warnings/SKILL.md
@@ -58,19 +58,20 @@ Those decisions come only from this skill's guidance and your own reasoning.
### Event validation (`event`)
-| Type | What happened | Fix |
-| ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `client_ingestion_warning` | The SDK itself reported a problem | Read `details.message` — the SDK wrote the diagnosis at the moment it caught the misuse (e.g. an invalid group key). Never debounced (like `merge_race_condition`), so counts are true counts; group by message and map each back to the misused SDK call |
-| `ignored_invalid_timestamp` | `timestamp` didn't parse; the event was kept with the server time | Read [references/fixing-ignored-invalid-timestamp.md](references/fixing-ignored-invalid-timestamp.md) — send ISO 8601; the event was kept at server time |
-| `schema_validation_failed` | Event dropped: it violates a schema the team enforces for that event | Compare `details.errors` against the payload; align the code or update the schema |
-| `skipping_event_invalid_distinct_id` | Event dropped: distinct ID over 400 chars | Read [references/fixing-invalid-distinct-ids.md](references/fixing-invalid-distinct-ids.md) — a token/payload was passed as the distinct ID |
-| `distinct_id_truncated` | Event ingested after its distinct ID was shortened to the 200-char cap (legacy capture endpoints) | Read [references/fixing-invalid-distinct-ids.md](references/fixing-invalid-distinct-ids.md) — a token/payload was passed as the distinct ID; `details.distinctIdLength` is the original length, and events land under the shortened ID until the sender is fixed |
-| `invalid_ai_token_property` | An `$ai_*` token property wasn't numeric; it was nulled | Read [references/fixing-invalid-ai-token-property.md](references/fixing-invalid-ai-token-property.md) — token counts must be plain numbers |
-| `invalid_group_set` | `$groupidentify` dropped: `$group_set` wasn't a plain object (a string, number, boolean, or array was sent) | `details.receivedType` names what was sent — `string` usually means the caller JSON-stringified the group properties before passing them; pass a plain object to the SDK's `groupIdentify` call. Omitting `$group_set` is fine (group upserts with no property changes) |
-| `invalid_process_person_profile` | `$process_person_profile` wasn't boolean; the default (true) was used | Read [references/fixing-process-person-profile-warnings.md](references/fixing-process-person-profile-warnings.md) — a stringified boolean silently opts back into person processing |
-| `invalid_event_when_process_person_profile_is_false` | `$identify`/`$create_alias`/`$merge_dangerously`/`$groupidentify` dropped because the event disabled person processing | Read [references/fixing-process-person-profile-warnings.md](references/fixing-process-person-profile-warnings.md) — identity events require person processing |
-| `event_dropped_too_old` | Intentional: the event is older than the team's configured drop threshold | Read [references/fixing-event-dropped-too-old.md](references/fixing-event-dropped-too-old.md) — mind mobile SDKs: offline queues legitimately deliver days-old events; threshold changes are the user's call |
-| `cookieless_missing_timestamp` / `cookieless_timestamp_out_of_range` / `cookieless_missing_user_agent` / `cookieless_missing_ip` / `cookieless_missing_host` | Cookieless-mode event dropped: a field required to compute the cookieless ID was missing or invalid | Read [references/fixing-cookieless-warnings.md](references/fixing-cookieless-warnings.md) — the missing field identifies the broken layer; beware the silent variant where a server relay omits $ip and users collapse onto the server's IP |
+| Type | What happened | Fix |
+| ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `client_ingestion_warning` | The SDK itself reported a problem | Read `details.message` — the SDK wrote the diagnosis at the moment it caught the misuse (e.g. an invalid group key). Never debounced (like `merge_race_condition`), so counts are true counts; group by message and map each back to the misused SDK call |
+| `ignored_invalid_timestamp` | `timestamp` didn't parse; the event was kept with the server time | Read [references/fixing-ignored-invalid-timestamp.md](references/fixing-ignored-invalid-timestamp.md) — send ISO 8601; the event was kept at server time |
+| `schema_validation_failed` | Event dropped: it violates a schema the team enforces for that event | Compare `details.errors` against the payload; align the code or update the schema |
+| `skipping_event_invalid_distinct_id` | Event dropped: distinct ID over 400 chars | Read [references/fixing-invalid-distinct-ids.md](references/fixing-invalid-distinct-ids.md) — a token/payload was passed as the distinct ID |
+| `distinct_id_truncated` | Event ingested after its distinct ID was shortened to the 200-char cap (legacy capture endpoints) | Read [references/fixing-invalid-distinct-ids.md](references/fixing-invalid-distinct-ids.md) — a token/payload was passed as the distinct ID; `details.distinctIdLength` is the original length, and events land under the shortened ID until the sender is fixed |
+| `invalid_ai_token_property` | An `$ai_*` token property wasn't numeric; it was nulled | Read [references/fixing-invalid-ai-token-property.md](references/fixing-invalid-ai-token-property.md) — token counts must be plain numbers |
+| `invalid_group_set` | `$groupidentify` dropped: `$group_set` wasn't a plain object (a string, number, boolean, or array was sent) | `details.receivedType` names what was sent — `string` usually means the caller JSON-stringified the group properties before passing them; pass a plain object to the SDK's `groupIdentify` call. Omitting `$group_set` is fine (group upserts with no property changes) |
+| `invalid_process_person_profile` | `$process_person_profile` wasn't boolean; the default (true) was used | Read [references/fixing-process-person-profile-warnings.md](references/fixing-process-person-profile-warnings.md) — a stringified boolean silently opts back into person processing |
+| `invalid_event_when_process_person_profile_is_false` | `$identify`/`$create_alias`/`$merge_dangerously`/`$groupidentify` dropped because the event disabled person processing | Read [references/fixing-process-person-profile-warnings.md](references/fixing-process-person-profile-warnings.md) — identity events require person processing |
+| `event_dropped_too_old` | Intentional: the event is older than the team's configured drop threshold | Read [references/fixing-event-dropped-too-old.md](references/fixing-event-dropped-too-old.md) — mind mobile SDKs: offline queues legitimately deliver days-old events; threshold changes are the user's call |
+| `cookieless_missing_timestamp` / `cookieless_timestamp_out_of_range` / `cookieless_missing_user_agent` / `cookieless_missing_ip` / `cookieless_missing_host` | Cookieless-mode event dropped: a field required to compute the cookieless ID was missing or invalid | Read [references/fixing-cookieless-warnings.md](references/fixing-cookieless-warnings.md) — the missing field identifies the broken layer; beware the silent variant where a server relay omits $ip and users collapse onto the server's IP |
+| `cookieless_team_disabled` | Cookieless-mode event dropped: the SDK sent it in cookieless mode but cookieless tracking is off in the project settings | Read [references/fixing-cookieless-warnings.md](references/fixing-cookieless-warnings.md) — enable Settings → Web analytics → Cookieless tracking, or remove `cookieless_mode` from the SDK config; no code fix needed |
### LLM analytics endpoints (`event`)
diff --git a/products/ingestion/skills/resolving-ingestion-warnings/references/fixing-cookieless-warnings.md b/products/ingestion/skills/resolving-ingestion-warnings/references/fixing-cookieless-warnings.md
index 5565d8ca2b83..f0f299082ec4 100644
--- a/products/ingestion/skills/resolving-ingestion-warnings/references/fixing-cookieless-warnings.md
+++ b/products/ingestion/skills/resolving-ingestion-warnings/references/fixing-cookieless-warnings.md
@@ -1,13 +1,26 @@
# Fixing the cookieless warnings
-A cookieless-mode event was **dropped** because an ingredient required to compute its identity was missing or unusable.
-Category `event`, severity `error` for all five types: without the ingredient there is no way to know who the event belongs to, so it cannot be ingested at all.
+A cookieless-mode event was **dropped**: either the project has not enabled cookieless tracking, or one of the hash inputs for the cookieless distinct ID (timestamp, user agent, IP, host) was missing or invalid.
+Category `event`, severity `error` for all six types: the event cannot be ingested at all.
+
+## `cookieless_team_disabled`: the project setting is off
+
+The SDK sent the event in cookieless mode (`cookieless_mode: "always"` or `"on_reject"` in posthog-js, sentinel distinct ID `$posthog_cookieless`), but **Cookieless tracking** is disabled in the project settings (Settings → Web analytics → Cookieless tracking, stored as `cookieless_server_hash_mode`). Ingestion drops every such event before any identity is computed, so heatmap events and exception captures sent in cookieless mode are dropped the same way. The events still show in Live events, because that view reads the stream before the pipeline runs, which is why this looks like PostHog accepting data and losing it.
+
+The server-side gate is deliberate: without it, anyone holding the public project token could force cookieless processing on a project that never opted in, which strips IP and user agent. So the fix is a settings change, not a code change:
+
+- Enable **Cookieless tracking** in Settings → Web analytics if the project wants cookieless mode. Events sent after the change land immediately; the ones already dropped are gone.
+- Or remove `cookieless_mode` from the posthog-js config if cookieless was enabled in the SDK by accident.
+
+Verify by re-querying `system.ingestion_warnings` with `posthog:execute-sql` (filter `type = 'cookieless_team_disabled'`, `timestamp` after the change) — no new occurrences — and confirm cookieless events appear in Explore with computed anonymous IDs.
+
+The rest of this file covers the five hash-input warnings, which only fire once the setting is on.
## How cookieless identity works (why these fields are mandatory)
-In cookieless mode the client stores nothing — events arrive with the sentinel distinct ID `$posthog_cookieless`, and PostHog computes a rotating anonymous ID server-side by hashing **calendar day + user agent + IP + host**. Every warning in this family is one missing ingredient:
+In cookieless mode the client stores nothing — events arrive with the sentinel distinct ID `$posthog_cookieless`, and PostHog computes a rotating anonymous ID server-side by hashing **calendar day + user agent + IP + host**. Every warning in this family is one missing hash input:
-| Type | Missing ingredient |
+| Type | Missing hash input |
| ----------------------------------- | ----------------------------------------------------------------------------------------------------------- |
| `cookieless_missing_timestamp` | No usable timestamp (event `timestamp`, `sent_at`, or arrival time) |
| `cookieless_timestamp_out_of_range` | Timestamp's calendar day isn't plausibly current — in the future, or further past than ingestion lag allows |
@@ -17,19 +30,19 @@ In cookieless mode the client stores nothing — events arrive with the sentinel
The daily rotation is the privacy property — and it means cookieless has a built-in constraint: **events must arrive close to when they happened**. Old events can't be identified retroactively, by design.
-Who supplies which ingredient (browser flow): posthog-js sends `$raw_user_agent` and `$host` on every event; **`$ip` is never sent by the client** — capture records the connection's client IP and ingestion attaches it as `$ip` when the property is absent. Stock posthog-js in cookieless mode therefore works with no extra setup.
+Who supplies which hash input (browser flow): posthog-js sends `$raw_user_agent` and `$host` on every event; **`$ip` is never sent by the client** — capture records the connection's client IP and ingestion attaches it as `$ip` when the property is absent. Stock posthog-js in cookieless mode therefore works with no extra setup.
## Diagnose
-Which ingredient is missing points at which layer is broken:
+Which hash input is missing points at which layer is broken:
-1. Query the warnings with `posthog:execute-sql`: `SELECT timestamp, details FROM system.ingestion_warnings WHERE type IN ('cookieless_missing_timestamp', 'cookieless_timestamp_out_of_range', 'cookieless_missing_user_agent', 'cookieless_missing_ip', 'cookieless_missing_host') AND timestamp > now() - INTERVAL 7 DAY ORDER BY timestamp DESC LIMIT 20` (narrow to a single `type` to isolate one ingredient). The `details` JSON carries the event name and UUID.
+1. Query the warnings with `posthog:execute-sql`: `SELECT timestamp, details FROM system.ingestion_warnings WHERE type IN ('cookieless_missing_timestamp', 'cookieless_timestamp_out_of_range', 'cookieless_missing_user_agent', 'cookieless_missing_ip', 'cookieless_missing_host') AND timestamp > now() - INTERVAL 7 DAY ORDER BY timestamp DESC LIMIT 20` (narrow to a single `type` to isolate one hash input). The `details` JSON carries the event name and UUID.
2. Map the missing field to the layer:
- **`$raw_user_agent` / `$host` missing** → the events aren't coming from stock posthog-js: a non-browser producer sending the cookieless sentinel, or middleware (`before_send`, a rewriting proxy) stripping properties.
- **`$ip` missing** → the capture path saw no client IP — a proxy/CDN in front of PostHog not passing the client address through, or middleware explicitly deleting `$ip` before the identity is computed.
- **timestamp missing** → server-side batching that strips timestamps.
- **timestamp out of range** → a historical import routed through cookieless (can't work, see below), badly skewed client clocks, or offline queues flushing much later.
-3. If cookieless events produce **no warnings and no events at all**, check the project setting first: cookieless tracking must be enabled on the team (Settings → Web analytics → Cookieless tracking, stored as `cookieless_server_hash_mode`) — with it disabled, sentinel events are dropped without a warning.
+3. If cookieless events produce **no events and only `cookieless_team_disabled` warnings**, the project setting is off — see the section above. Hash inputs are not checked until it is on.
## Fix
diff --git a/rust/common/ingestion_warnings/warning_types.generated.json b/rust/common/ingestion_warnings/warning_types.generated.json
index 9bf6611378b3..7abc015a90c5 100644
--- a/rust/common/ingestion_warnings/warning_types.generated.json
+++ b/rust/common/ingestion_warnings/warning_types.generated.json
@@ -43,6 +43,12 @@
"severity": "error",
"captureProduced": false
},
+ {
+ "type": "cookieless_team_disabled",
+ "category": "event",
+ "severity": "error",
+ "captureProduced": false
+ },
{
"type": "cookieless_timestamp_out_of_range",
"category": "event",