Skip to main contentHomepage

Vite + Posthog

A vite plugin for integrating with Posthog

Vite
Analytics
Typescript
Open Source
Mar 15, 2024
Vite + Posthog

I noticed a little gap in the Posthog docs and their implementation for React apps after moving from CRA to Vite.

npm version

npm downloads

npm weekly downloads

License

GitHub stars

Vite has a pretty good way to load in scripts into the DOM, which I felt like the posthog team hadn't capitalised on. So I thought I'd create an open source package that did.

Loading in PostHog's JS SDK underneath and adding a few more React specific hooks.... vite-plugin-posthog was born