npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

pulsent-recorder

v0.2.5

Published

First-party session recording SDK for Pulsent

Readme

pulsent-recorder

npm version npm downloads License: MIT Release

First-party session recording SDK for Pulsent. If your app already runs PostHog, this SDK hooks directly into its recording pipeline so you get full-fidelity sessions in Pulsent — with no second recorder, no extra CPU, and no duplicate work.


How it works

PostHog buffers rrweb events and flushes them as $snapshot batches every ~2 seconds. pulsent-recorder taps into PostHog's before_send pipeline to forward each batch to Pulsent alongside the existing PostHog flow. PostHog keeps recording as normal — Pulsent just listens.

PostHog JS SDK (already running)
  └── before_send intercepts $snapshot batches
      └── POST https://api.pulsent.ai/replays/ingest

Session end is detected through three signals:

  • Session rotationposthog.onSessionId fires on idle timeout or max session length
  • Tab closenavigator.sendBeacon on beforeunload
  • Cron fallback — 30-minute server-side sweep for sessions with no recent activity

Installation

npm install pulsent-recorder
# or
pnpm add pulsent-recorder

posthog-js must already be installed in your project. pulsent-recorder has no dependencies of its own.


Usage

Recommended: beforeSendHandler (zero-miss)

Inject the handler directly into PostHog's config so it captures snapshots from the very first event — including the initial DOM snapshot that fires before loaded callbacks.

import posthog from 'posthog-js'
import { PulsentRecorder } from 'pulsent-recorder'

const pulsent = PulsentRecorder.beforeSendHandler()

posthog.init('phc_your_project_token', {
  api_host: 'https://eu.i.posthog.com',
  defaults: '2026-01-30',
  before_send: pulsent.handler,
  loaded: (ph) => pulsent.bind(ph),  // starts session lifecycle tracking
})

React

// src/main.tsx
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import posthog from 'posthog-js'
import { PostHogProvider } from 'posthog-js/react'
import { PulsentRecorder } from 'pulsent-recorder'
import App from './App'

const pulsent = PulsentRecorder.beforeSendHandler()

posthog.init(import.meta.env.VITE_PUBLIC_POSTHOG_TOKEN, {
  api_host: import.meta.env.VITE_PUBLIC_POSTHOG_HOST,
  defaults: '2026-01-30',
  before_send: pulsent.handler,
  loaded: (ph) => pulsent.bind(ph),
})

createRoot(document.getElementById('root')!).render(
  <StrictMode>
    <PostHogProvider client={posthog}>
      <App />
    </PostHogProvider>
  </StrictMode>
)

React (PostHogProvider only)

// src/main.tsx
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import { PostHogProvider } from 'posthog-js/react'
import { PulsentRecorder } from 'pulsent-recorder'
import App from './App'

const pulsent = PulsentRecorder.beforeSendHandler()

createRoot(document.getElementById('root')!).render(
  <StrictMode>
    <PostHogProvider
      apiKey={import.meta.env.VITE_PUBLIC_POSTHOG_TOKEN}
      options={{
        api_host: import.meta.env.VITE_PUBLIC_POSTHOG_HOST,
        defaults: '2026-01-30',
        before_send: pulsent.handler,
        loaded: (ph) => pulsent.bind(ph),
      }}
    >
      <App />
    </PostHogProvider>
  </StrictMode>
)

Legacy: PulsentRecorder.init

Still works, but may miss the initial DOM snapshot on pages where PostHog starts recording from cached config before the loaded callback fires.

posthog.init('phc_your_project_token', { ... })
PulsentRecorder.init({ posthog })

API

PulsentRecorder.init(config)

Starts recording. Returns a PulsentRecorder instance.

| Option | Type | Description | |--------|------|-------------| | posthog | PostHog | Your initialized PostHog instance |

recorder.destroy()

Removes all event listeners and stops forwarding snapshots. Optional — only needed if you need explicit cleanup.


Requirements

  • posthog-js must be initialized with session recording enabled before calling PulsentRecorder.init
  • The PostHog project token must be registered in your Pulsent workspace settings

Releases

Changelogs live on the GitHub Releases page. Every published version has human-written release notes describing what changed and any migration steps. Each npm version is also signed with provenance, so you can trace any release on npm back to the exact GitHub Actions run and source commit that built it.


License

MIT