PostHog integration
PostHog is product analytics with session replay, feature flags and surveys in one tool. We add it to Framer and Webflow through custom code, and to Astro and Next.js with PostHog’s official guides and posthog-js. We route events through a reverse proxy, choose EU hosting when it matters, and set cookieless mode or opt-in to match your consent setup.
| Complexity | Medium |
|---|---|
| Method |
|
| Typical setup | Half a day to 1 day |
| What we do | We install PostHog, set up the reverse proxy and consent mode, and define the events and funnels for your key flows. |
| Category | Analytics |
Setup by platform
How we set up PostHog
Framer
- Embed
The PostHog snippet goes at the end of the head in Framer’s site custom code, then we publish. PostHog’s Framer guide notes custom code needs a paid Framer plan.
Webflow
- Embed
The snippet goes in Site settings, Custom code, Head code, on a paid site plan. Custom events for forms and CTAs are a few lines in the footer code.
Astro
- Embed
Following PostHog’s Astro guide, a posthog.astro component with is:inline sits in the base layout. With view transitions we guard against double init and capture pageviews on history changes.
Next.js
- API
posthog-js initialised in instrumentation-client.ts for the App Router, plus posthog-node for server-side events and flags. Next.js rewrites act as the reverse proxy.
Use cases
What teams use it for
Funnels from visit to signup
See where visitors drop between the homepage, pricing and the signup or demo form.
Session replay for UX fixes
Watch real sessions on a new page to find what confuses people, without guessing.
Feature flags and tests
Roll out a new hero or pricing layout to part of your traffic and compare.
Before you add it
What to watch out for
Consent and GDPR
Cookieless or opt-in
cookieless_mode 'always' skips cookies and storage; 'on_reject' stays cookieless if denied. Both need server hashing on. A banner is still a legal call.
Data layer
Proxy events through your domain
Ad blockers block analytics domains. PostHog says a reverse proxy typically lifts captured events by 10 to 30 percent, and offers a managed one.
Performance
Replay loads on demand
The snippet loads async and only core features load by default; session replay, surveys and error tracking are lazy-loaded when you use them.
FAQ
Questions about PostHog
Can PostHog keep data in the EU?
Yes. PostHog Cloud EU runs in Frankfurt, with the ingestion host eu.i.posthog.com. The region is chosen when the project is created.
Why does PostHog recommend a reverse proxy?
Ad blockers block known analytics domains. Sending events through your own domain recovers most of them; PostHog estimates 10 to 30 percent more events captured.
PostHog or Google Analytics?
GA4 is strong for acquisition and Google Ads. PostHog is better for what people do on the site and in the product: funnels, replays and flags. Many teams run both.
You've reached the end, so now…
Tell us what you’re building.
We’ll help you map the right scope, team, timeline, and next steps.
Book a call