guide ยท nuxt & vue
Add a Free Bug Report Widget to Vue 3 & Nuxt 3
How do you add a bug report widget to Nuxt 3 or Vue 3? Add BugSnap's 18 KB defer script to app.head.script in nuxt.config.ts (SSR-safe) or index.html in Vue 3. It auto-masks sensitive fields, captures up to 20 recent errors, and exports 1-click Markdown at $0 forever.
1. nuxt 3: add it to nuxt.config.ts
Nuxt renders app.head scripts into the server HTML, and the browser runs them after parsing, so there is no window is not defined error during SSR and no client-only plugin to write:
export default defineNuxtConfig({
app: {
head: {
script: [
{
src: 'https://getbugsnap.pages.dev/widget.js',
'data-project-key': 'YOUR_PROJECT_KEY',
'data-trigger': 'on-error',
defer: true,
},
],
},
},
})
2. vue 3 (vite): add it to index.html
For a plain Vue 3 app, paste the tag into index.html before </body>. No npm package and no plugin registration:
<script
src="https://getbugsnap.pages.dev/widget.js"
data-project-key="YOUR_PROJECT_KEY"
data-trigger="on-error"
defer
></script>
The widget listens at the window level, so it keeps working across Vue Router and Nuxt page navigations.
3. why it fits vue and nuxt
- Zero runtime dependencies: 18 KB minified (about 8 KB gzipped), loaded with
deferso it never blocks Vue hydration. - Invisible by default: with
data-trigger="on-error"it stays hidden until a JavaScript crash, failed API call, broken image or dead click. - Masked before capture: passwords, emails, phones, card and checkout inputs, payment iframes and
data-bugsnap-maskelements never reach the screenshot. - Markdown for AI fixes: each report includes up to 20 recent errors and copies as Markdown for Claude Code, Cursor or Codex.
Using another stack? See the Next.js, React & Vite and Astro guides. Testing a bug yourself? Scrub your console output with the free log privacy redactor, then turn it into an agent prompt with the bug report to AI prompt generator. Or go back to the BugSnap homepage.