PostHog across your site and product
PostHog joins up what happens on your marketing site with what happens in your product. We set it up so one person is one person, from first visit to activation.
How we set it up
The method depends on where your site is built. Here is what we use for PostHog on each platform.
Framer
On Framer, the PostHog web snippet goes into custom code, set to opt out by default and opted in when the visitor accepts analytics cookies. Session replay and autocapture work on Framer pages, and form submissions are captured as named events.
Framer development EmbedWebflow
We place the PostHog snippet in Webflow’s head custom code, opted out by default until consent, and capture form submissions as named events. If your app runs on a subdomain, a shared cookie domain keeps one identity across site and product.
Webflow development Official guideAstro
PostHog’s Astro guide uses an inline snippet in a layout component. We add an initialization guard when Astro’s client router is on, so PostHog does not re-run on page transitions, and route requests through a reverse proxy on your own domain.
Astro development Official SDKNext.js
We install posthog-js and initialize it in instrumentation-client, which covers both the app and pages router. Requests go through Next.js rewrites as a reverse proxy, and server-side events or feature flags use posthog-node in route handlers.
Next.js developmentWhat teams use it for
Site-to-product funnels
See which landing pages bring people who actually activate, not just sign up.
Feature flags
Release a new onboarding step or app feature to part of your users first, and switch it off without a deploy.
Session replay for UX
Watch how new users move through sign-up and the first session in the app.
What to watch out for
PostHog sets a cookie by default. Start opted out or cookieless until consent, and choose the EU cloud if data location matters.
Autocapture records a lot. Define named events for what matters, or reports become hard to trust.
Replay and autocapture add work in the browser. Sample replays and keep the snippet off pages you do not analyze.
Questions about PostHog
PostHog or Google Analytics?
Why put PostHog behind a reverse proxy?
Can PostHog store data in the EU?
Does PostHog need cookie consent?
How long does a PostHog setup take?
Thomas OldenburgerFounder, design and build leadStill deciding? A 30-minute call answers most of it.
Related integrations and services
Segment
Customer data platform from Twilio that collects events once and sends them to many tools.
OpenGoogle Analytics
Google’s free web analytics (GA4) for traffic, events, conversions and acquisition reports.
OpenMicrosoft Clarity
Free heatmaps and session recordings from Microsoft, with rage-click and dead-click detection.
OpenProduct design
PostHog funnels and replays tell us where users drop out of onboarding.
OpenOnboarding
Glossary definition.
Open