Skip to content

fix: preserve PostHog cookieless identity fields - #193

Merged
flamboh merged 2 commits into
mainfrom
t3code/posthog-app-errors-usage
Aug 30, 2026
Merged

flamboh merged 2 commits into
mainfrom
t3code/posthog-app-errors-usage

Conversation

@flamboh

@flamboh flamboh commented Aug 30, 2026

Copy link
Copy Markdown
Owner

Note

🤖 GPT-5.6 Sol on behalf of Oliver

problem

Tagium's privacy sanitizer removed PostHog fields required for cookieless identity. PostHog needs $cookieless_mode, $raw_user_agent, $host, and the request IP; missing $host causes the event to be dropped before identity generation.

This does not fix PostHog's query-time traffic classification. PostHog deliberately removes the raw user agent and IP after computing the cookieless identity, so stored cookieless events may still appear as Automation / no_user_agent.

solution

  • preserve $cookieless_mode: true
  • preserve raw user agents up to PostHog's 1,000-character limit
  • preserve only the canonical host for the active app: tagium.app or save.tagium.app
  • scope the host and raw-user-agent exceptions to cookieless events
  • keep rejecting URL-shaped, empty, foreign, and wrong-app host values

human review

Setup: use the production PostHog project with cookieless server hash mode enabled and send fresh events through t.tagium.app.

  1. Exercise both tagium.app and save.tagium.app.
  2. Confirm fresh events no longer produce cookieless_missing_host ingestion warnings.
  3. Confirm identities are server-generated rather than left as $posthog_cookieless.
  4. Confirm the proxy forwards the real client IP.
  5. Confirm stored events do not retain $raw_user_agent or $ip.

Important edge cases: malformed, empty, foreign, wrong-app, and non-cookieless host inputs are rejected. Historical dropped events cannot be repaired.

Decision for review: this PR improves cookieless ingestion and identity quality only. Query-time bot classification remains an upstream PostHog limitation; the app does not duplicate raw identifiers to bypass PostHog's privacy boundary.

Automatically verified with 100 test files / 660 tests, TypeScript typecheck, targeted lint, and diff validation. The PostHog project setting and production proxy IP behavior still require manual verification after deployment.

Changes were implemented and reviewed by GPT-5.6 Sol and GPT-5.6 Luna in T3 Code through the Codex harness.

@github-actions

github-actions Bot commented Aug 30, 2026

Copy link
Copy Markdown

React Doctor found no new issues. 🎉

Reviewed by React Doctor for commit f03b55c.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 30, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
tagium f03b55c Commit Preview URL

Branch Preview URL
Aug 30 2026, 06:13 PM

@flamboh
flamboh force-pushed the t3code/posthog-app-errors-usage branch from 97a7bd3 to fc9f156 Compare August 30, 2026 17:24
@flamboh flamboh changed the title fix: preserve PostHog classification fields fix: preserve PostHog cookieless identity fields Aug 30, 2026
@flamboh
flamboh force-pushed the t3code/posthog-app-errors-usage branch from fc9f156 to f03b55c Compare August 30, 2026 18:12
@flamboh
flamboh merged commit cb9ed43 into main Aug 30, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant