Frameworks
Which parts of the SDK each stack uses, with a setup page per stack.
The browser core has no framework dependency, so any stack that bundles ES modules can use it. Next.js and React get dedicated entries; the other stacks use the core and plugins directly.
| Stack | What you use | Page |
|---|---|---|
| Next.js 15 or later | The core, /react, /next, /proxy and /server | Next.js |
| React 19 with any router, Vite | The core and /react | React |
| Plain TypeScript or JavaScript with a bundler | The core and plugins | Vanilla |
| Vue with Vite or another bundler | The core and plugins | Vue |
| Svelte and SvelteKit | The core and plugins | Svelte |
| Astro | The core and plugins in a client script, /proxy and /server in endpoints | Astro |
| Node, Bun, Deno, Vercel Functions, Cloudflare Workers, other languages | /server and /proxy, or POST /v2/events | Server |
What every setup has in common
- A project with two keys: the public key (
pk_...) goes to the browser, the secret key (sk_...) stays in server environment variables. Quick start creates both. - An
events.tstype that lists your custom events once, shared by the browser and server clients. See Concepts. - One client created with
createAnalyticsin its own module and imported wherever you track. It starts itself only wherewindowexists, so importing it during server rendering sends nothing. - Where you have a server, a same-origin path such as
/_raserved bycreateProxy, so ad blockers see a first-party request. See Proxy.