Appearance
Vue and Nuxt
Install
sh
npx simpledatalogs init
npm install simpledatalogsinit tells Vue and Nuxt apart and shows the diff before writing.
Vue on Vite
sh
# .env.local
VITE_SIMPLEDATALOGS_KEY=sdl_pub_…ts
// src/main.ts, after the other imports
import { init } from 'simpledatalogs'
init({ key: import.meta.env.VITE_SIMPLEDATALOGS_KEY, autocapture: true })Nuxt
A client-only plugin (app/plugins/ on Nuxt 4, plugins/ before):
ts
// app/plugins/simpledatalogs.client.ts
import { init } from 'simpledatalogs'
export default defineNuxtPlugin(() => {
init({ key: 'sdl_pub_…', autocapture: true })
})A public key is write-only and safe in the browser, so it can sit in the file. To keep it in the environment instead, add runtimeConfig.public.simpledatalogsKey to nuxt.config and read it with useRuntimeConfig().
Only your own events
Leave out autocapture and call track():
ts
const sdl = init({ key: 'sdl_pub_…' })
sdl.track('report_exported', { format: 'csv' })In the first minute
session_startand apage_viewwithpath,title,referrerandutm_*.- A
page_viewon every Vue Router navigation that changes the path. - Uncaught errors and unhandled rejections on the Logs tab. Errors Vue catches itself go to
app.config.errorHandler; forward them withsdl.log('error', error).
Autocapture defaults
| Feature | autocapture: true |
|---|---|
| Page views, including router navigation | on |
| Sessions | on |
| Errors and unhandled rejections | on |
| Outbound link clicks | off |
| Do Not Track / Global Privacy Control | respected |