Vue
Vue 3 (and Nuxt) + @millimetric/track.
Install
npm i @millimetric/trackVue 3 (Vite)
Init in your entry file:
// src/main.ts
import { createApp } from "vue";
import { init } from "@millimetric/track";
import App from "./App.vue";
import router from "./router";
init({
key: import.meta.env.VITE_AOA_KEY,
host: import.meta.env.VITE_AOA_HOST ?? "https://api.millimetric.ai"
});
createApp(App).use(router).mount("#app");The SDK auto-fires $pageview on history.pushState, so Vue Router navigations are picked up automatically.
Identify on login
Call useIdentify() once, e.g. in your root component's setup().
Track on intent
A Vue plugin (optional)
If you'd rather inject the SDK as a plugin so useTrack() is available everywhere:
The provided track and identify are the same functions — there's no advantage over importing them directly except for stricter test isolation.
Nuxt 3
A client-only plugin:
Then anywhere in components:
Server-side events from a Nitro route
Use @millimetric/track-node with an sk_* key:
Don't import @millimetric/track-node in client-only code — it expects sk_* keys that should never reach the browser.
Last updated
Was this helpful?