NPM Package (Recommended)
For more control and TypeScript support, use the NPM package.Installation
Initialize
Add the tracker to your app entry point:Supported Frameworks (NPM)
| Framework | Entry point file |
|---|---|
| React (Vite) | src/main.tsx or src/index.tsx |
| React (CRA) | src/index.tsx |
| Next.js | pages/_app.tsx or app/layout.tsx |
| Vue (Vite) | src/main.ts |
| Vue CLI | src/main.ts |
| Nuxt 3 | Plugin in plugins/ directory |
| Svelte | src/main.ts |
| SvelteKit | +layout.svelte or hooks.client.ts |
| Angular | src/main.ts |
| Remix | app/entry.client.tsx |
HTML Script Tag
The simplest way to add Sonarly - just paste this script in your HTML file.Installation
Add this script before the closing</head> tag in your main HTML file (index.html, app.html, or layout file):
Supported Frameworks (HTML)
Works with any framework that has an HTML entry point:| Framework | Where to add the script |
|---|---|
| React (Vite) | index.html |
| React (CRA) | public/index.html |
| Next.js | pages/_document.js or app/layout.tsx |
| Vue (Vite) | index.html |
| Vue CLI | public/index.html |
| Nuxt 3 | app.vue or nuxt.config.ts (via head) |
| Svelte | app.html |
| SvelteKit | src/app.html |
| Angular | src/index.html |
| Remix | app/root.tsx |
| Vanilla JS | Your HTML file |
Configuration Options
| Option | Type | Description |
|---|---|---|
projectKey | string | Your project key from the dashboard |
ingestPoint | string | Ingestion endpoint (https://sonarly.dev/ingest) |
__debug__ | number | Debug level (0-5, use 5 for verbose logging) |
Verify Installation
Check your browser console for Sonarly initialization messages. Sessions should appear in your dashboard within seconds. At the end of the onboarding, Sonarly provides a detector that verifies each part of the tracker (frontend, sourcemaps, backend traces) is working correctly.Configure sourcemaps
Enable readable stack traces with sourcemap upload

