hindsight_posthog

PostHog integration for the hindsight session replay SDK. Keep your PostHog — every Dart-captured analytics event gains a one-click link to the moment in the session replay.

What it does:

  • Tags kept PostHog events with hindsight.session_id and hindsight.replay_url.
  • Reads the Hindsight session at event time, so rotated replay sessions tag the next PostHog event correctly.
  • Mirrors kept PostHog $exception events as replay error markers and other kept PostHog events as posthog breadcrumbs.
  • Wraps pre-existing beforeSend callbacks and honors their drop decisions.

Usage

await Hindsight.init(HindsightConfig(projectId: 'my-app', apiKey: 'hs_...'));
final config = PostHogConfig('phc_...');
HindsightPosthogIntegration().attach(config);
await Posthog().setup(config);
runApp(HindsightWidget(child: const MyApp()));

The integration resolves the Hindsight singleton when each PostHog event is processed. Multi-client setups can inject a specific client instead: HindsightPosthogIntegration(client: myClient).

PostHog's beforeSend currently applies to Dart-originated capture, screen, and captureException events. Native lifecycle, feature flag, survey, identity, and PostHog session replay events are not intercepted by this adapter.

Libraries

hindsight_posthog
PostHog integration for the hindsight session replay SDK.