posthog with astro

PostHog with Astro

See what somebody did before they signed up, then connect that activity to who they become in your product. Events, campaign attribution, identity, session replay and feature flags, set up as one system rather than five installs.

PostHog at a glance

What I do
Connect Astro to PostHog so marketing visits, signup behavior and product activation can be read as one funnel.
Typical setup
Adds 2–4 days
How it is bought
Part of a migration scope, or a Continuous development request once the site is yours

How I set up PostHog

The useful question is not how many people saw pricing. It is which pricing visitors later signed up, activated and stayed. That only works if the marketing site and product agree on identity.

I fire the important events explicitly: form submitted, demo requested, signup started, plan clicked. Autocapture can still help discovery, but it should not be the only source of truth.

Session replay is handled carefully. Recording every visitor on every page creates privacy risk and hours of footage nobody watches. Scoped to key pages, with masking and consent rules, it can answer real conversion questions.

How the handoff works

  1. 01

    Event

    Named, fired deliberately on the page

  2. 02

    Anonymous ID

    The visitor before they are anybody

  3. 03

    Campaign

    Parameters carried through to signup

  4. 04

    Signup

    The anonymous history aliased to the account

    Key handoff

  5. 05

    One person

    Pre-signup activity joined to the user in the product

Why this is the key handoff

The join is the whole job. Somebody's anonymous marketing activity should still belong to them after they become a product user. Every step succeeds on its own either way, which is why I check the alias at the point of signup rather than taking the default: the failure is silent, and it only shows up when somebody asks which page produced an activated user.

What gets connected

  • Explicit marketing events for the actions that matter

  • Anonymous-to-known identity flow across the site and the product

  • Campaign parameters carried into signup

  • Session replay and feature flags scoped to where they are useful

  • Consent-aware loading and capture rules

What to watch out for

  1. 01

    Feature flag flicker

    A flag resolving in the browser renders the default first and swaps afterward, which on a hero is a visible flash and a layout shift counted against the page. I test the initial resolution and the identity change.

  2. 02

    Brittle autocapture

    Events keyed to DOM structure change meaning when somebody restyles a section, so a small set of named events holds up better across a redesign.

  3. 03

    Broken identity joins

    Pre-signup activity can start a second history instead of joining the known user. I test that it joins, and check the expected volume against how the account is priced.

Next step

Let me plan your next step.

Send your site

I can scope a migration. Send a brief and I will reply by email with next steps.