Skip to content

feat: add PostHog analytics via a same-origin CloudFront proxy#53

Merged
NeedToUpdate merged 1 commit into
devfrom
feat/revamp
Jul 13, 2026
Merged

feat: add PostHog analytics via a same-origin CloudFront proxy#53
NeedToUpdate merged 1 commit into
devfrom
feat/revamp

Conversation

@NeedToUpdate

Copy link
Copy Markdown
Owner

Wires in posthog-js through Next.js's instrumentation-client.ts (no provider/pageview boilerplate needed with the current SDK defaults). Events route through a new /relay/* CloudFront behavior straight to PostHog's own origin — a CloudFront Function strips the prefix, no Lambda invocation involved — so requests are same-origin and don't get dropped by ad/tracker blockers the way a direct posthog.com call would. Dev and prod use separate PostHog projects, tokens injected per-stage via GitHub Actions secrets at build time.

Wires in posthog-js through Next.js's instrumentation-client.ts (no
provider/pageview boilerplate needed with the current SDK defaults).
Events route through a new /relay/* CloudFront behavior straight to
PostHog's own origin — a CloudFront Function strips the prefix, no
Lambda invocation involved — so requests are same-origin and don't
get dropped by ad/tracker blockers the way a direct posthog.com call
would. Dev and prod use separate PostHog projects, tokens injected
per-stage via GitHub Actions secrets at build time.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@NeedToUpdate NeedToUpdate merged commit 1df5524 into dev Jul 13, 2026
1 check 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