Skip to Content
GenerateSaaS

Session replay and surveys

Turn on PostHog session replay with every input and every line of text masked, keep it off the pages that hold credentials or billing, and ask stalled users what stopped them with PostHog Surveys.

PostHog's own session replay and surveys, each behind one flag under config.analytics.posthog. Both ship off; with PostHog not configured, neither exists.

packages/config/src/index.ts
analytics: {
  posthog: {
    publicKey: "phc_...",
    host: "https://us.i.posthog.com",
    sessionReplay: true, // default false
    surveys: true // default false
  }
}

Session replay

posthog.init always starts with recording disabled, whatever the project's remote settings say. With sessionReplay: true the masking below is passed to the SDK and <SessionReplayController> starts and stops the recorder page by page (apps/web/lib/analytics/session-replay.ts).

Masked or blockedHow
Every input valuemaskAllInputs: true
Every text nodemaskTextSelector: "*"
Images, video, canvasblockSelector, recorded as placeholders
Network headers and bodiesrecordHeaders: false, recordBody: false
Never recordedRule
Sign-in and sign-upthe section of config.routes.auth
Settings, billing among themthe sections of config.routes.settings and config.routes.settingsBilling
Adminthe section of config.routes.admin
Checkout and link pages/checkout, /delete-account, /accept-invitation, /unsubscribe
A token in the addressany URL urlCarriesCredential flags
A visitor without consentPostHog waits for the cookie banner
An opted-out accountusers.analyticsOptOut (opt-out), and while the session is still loading
Local builds and the e2e harnessa page served from loopback never starts PostHog

Masking shows where people clicked and how the layout responded, never what they read or typed. Still list replay in your privacy policy, and set the retention you want under PostHog → Session replay → Settings.

Surveys

surveys: false passes disable_surveys: true, so the SDK never fetches survey definitions. With surveys: true PostHog shows the surveys you create and target in its UI; no code is needed.

In PostHog, Surveys → New survey, type Popover, one open text or single choice question: "What stopped you from finishing?".

Display conditions → User sends events: pick a wall or stall from Product signals - limit_reached, paywall_viewed, form_error or error_shown. Add a property filter such as surface = chat to aim it at one screen.

Set Survey wait period (for example 14 days) so a person is asked once, then launch. Responses arrive as survey sent events tied to the same person, beside the events that triggered them.

A survey's free-text answer is content the person chose to send you. It lives in PostHog only, never in your database, and a visitor who declined consent is never shown a survey.

On this page