Session replays in the VS Code extension
Contents
The VS Code extension connects your code to Session Replay data, showing you how many sessions and users are triggering events and letting you jump directly to replays in PostHog.
CodeLens session and user counts
Above each capture() call and feature flag check in your code, the extension shows CodeLens indicators with:
- Session count — How many sessions triggered this event
- User count — How many unique users triggered this event
These counts give you a quick sense of how actively a piece of code is being exercised in production, without needing to check PostHog separately.

Watching sessions
To view session replays for a specific event:
- Click the sessions CodeLens link above a
capture()call, or - Run PostHog: Watch Sessions from the command palette
This opens the relevant session replays in PostHog in your browser, filtered to the event you selected. From there you can watch full session recordings to understand user behavior in context.
Connecting events to code
The session replay integration works in both directions:
- Code to replays — From a
capture()call in your editor, jump to sessions where that event fired - Flags to replays — From a feature flag check, see sessions where that flag was evaluated
This makes it easy to go from reading code to understanding how real users interact with that code in production.