Skip to main content

PostHog

Web Source code Package

PostHog is an open-source product analytics platform with session replay, feature flags, A/B testing, surveys, and heatmaps. This destination forwards walkerOS events to PostHog via the official posthog-js SDK, translating events into posthog.capture(...) calls, resolving identity and group assignments, and handling consent opt-in/opt-out. All built-in PostHog features (session replay, feature flags, surveys, heatmaps, exception capture) are available through SDK init passthrough.

Where This Fits

PostHog is a web destination in the walkerOS flow:

Loads the PostHog SDK, forwards every walkerOS event, and lets you layer on identity, person properties, groups, and consent handling.

Installation

Loading...

Setup

Loading...

Configuration reference

PropertyTypeDescriptionMore
apiKey*stringYour PostHog project API key (starts with "phc_"). Find it in your PostHog project settings under "Project API Key" (like phc_a1b2c3d4e5f6789012345678abcdef12).
api_hoststringPostHog API host. Defaults to https://us.i.posthog.com. Use https://eu.i.posthog.com for the EU region.
ui_hoststringURL of the PostHog UI host, used by toolbar and replay player. Default: null.
persistenceWhere to persist user identity. Default: "localStorage+cookie".
person_profilesWhen to create person profiles. "identified_only" (default) creates profiles only after identify() is called.
autocapturebooleanEnable PostHog's autocapture of clicks, form submits, and pageviews. Default: false (walkerOS sources handle capture).
capture_pageviewboolean | stringWhether PostHog should auto-capture pageview events. Default: false (walkerOS sources handle this).
capture_pageleaveboolean | stringWhether PostHog should auto-capture pageleave events. Default: false.
capture_heatmapsbooleanEnable heatmap data capture. Default: true (PostHog default).
capture_exceptionsbooleanEnable automatic exception capture. Default: false.
disable_surveysbooleanDisable PostHog surveys. Default: false.
disable_session_recordingbooleanDisable session recording. Default: false.
advanced_disable_flagsbooleanDisable feature flag loading. Default: false.
cookieless_mode'always' | 'on_reject'"always" never uses cookies/localStorage. "on_reject" falls back to cookieless when consent is rejected.
debugbooleanEnable PostHog SDK debug logging. Default: false.
session_recordinganySession Replay options (SessionRecordingOptions). Masking, blocking, sampling. See PostHog docs for full list.
bootstrapanySSR bootstrap data. { distinctID?, featureFlags? } — pre-populates identity and flag values to avoid first-render flicker.
identifyanywalkerOS mapping value resolving to an identity object. Keys: distinctId, $set, $set_once. Resolved on first push and re-fired when distinctId changes.
groupanywalkerOS mapping value resolving to a group object. Keys: type, key, properties. Resolved on first push and re-fired when type/key changes.
* Required fields

Mapping data.examples

tip

The code data.examples are interactive. You can edit the code to generate your individual event mapping.

Default event forwarding

Every walkerOS event becomes posthog.capture(event.name, properties). Without include config, properties is empty. Add include: ['data'] to the destination config to forward event data as properties.

Event
Loading...
Mapping
Loading...
Result
Loading...

Identify with $set and $set_once

Resolve a mapping value into the PostHog identity vocabulary. distinctId is the new user ID, $set overwrites person properties, and $set_once only sets properties that do not yet exist.

Event
Loading...
Mapping
Loading...
Result
Loading...

Person properties only (no identity change)

When the resolved identify object has no distinctId, the destination calls posthog.setPersonProperties(...) instead, which is useful for profile updates that should not create a new identity.

Event
Loading...
Mapping
Loading...
Result
Loading...

Group assignment

Resolve a group mapping into posthog.group(type, key, properties?) calls for B2B analytics by company, team, or any custom group type.

Event
Loading...
Mapping
Loading...
Result
Loading...

Order complete with flattened properties

PostHog has no dedicated revenue API. Revenue events are regular capture() calls. Use include: ['data', 'globals'] to flatten walkerOS sections into prefixed properties (data_currency: "EUR", data_total, etc.).

Event
Loading...
Mapping
Loading...
Result
Loading...

Declare required consent keys via config.consent. When a walker consent event arrives with all declared keys granted, the destination calls posthog.opt_in_capturing(). When any declared key is revoked, it calls posthog.opt_out_capturing(), which stops capture, session replay, and survey rendering:

Loading...

Without config.consent the destination takes no action on consent changes; the walkerOS config.consent gate still blocks unconsented events from reaching the destination in the first place.

Built-in features

All these PostHog features work via standard posthog-js init options, with no destination wiring required:

  • Session replay: settings.session_recording: { maskAllInputs: true, ... }
  • Feature flags: settings.bootstrap: { featureFlags: { ... } } for SSR
  • Surveys: automatic; settings.disable_surveys: true to opt out
  • Heatmaps: settings.capture_heatmaps: true
  • Exception capture: settings.capture_exceptions: true
  • Cookieless mode: settings.cookieless_mode: 'always' | 'on_reject'
  • Person profiles: settings.person_profiles: 'identified_only' (PostHog default, privacy-friendly) or 'always'

walkerOS sets three defaults that differ from PostHog's built-ins: autocapture: false, capture_pageview: false, capture_pageleave: false, because walkerOS sources handle event capture. Override them explicitly if you want PostHog's autocapture on.

💡 Need implementation support?
elbwalker offers hands-on support: setup review, measurement planning, destination mapping, and live troubleshooting. Book a 2-hour session (€399)