Vue and Nuxt In development

The nabd-vue package as a plugin, with a Nuxt module.

Not available yet. These examples show the planned API; package and function names may change before the first release.

Install

bash
npm install nabd-browser nabd-vue

Vue

main.ts
import { createNabd } from 'nabd-vue';

const app = createApp(App);
app.use(router);
app.use(createNabd({
  orgToken: import.meta.env.VITE_NABD_KEY,
  appName: 'My App',
  consentRequired: true,
  router, // screen names from route patterns
}));
app.mount('#app');

The screen name is the route pattern (/invoices/:id), or meta.nabdScreen for a custom name. Component errors are recorded, and your app.config.errorHandler keeps working.

Nuxt

nuxt.config.ts
export default defineNuxtConfig({
  modules: ['nabd-vue/nuxt'],
  nabd: {
    orgToken: process.env.NUXT_PUBLIC_NABD_KEY,
    appName: 'My Site',
    consentRequired: true,
  },
});

Consent and events

script setup
const nabd = useNabd();

nabd.setConsent(true);
nabd.trackEvent('taskCompleted', { screen: 'invoice_create' });