Add privacy-first analytics to your Vue.js app
Set up Measure in your Vue 3 app — no cookies, no cookie banner needed, a couple of KB. Works with Vue Router, the Composition API and SSR.
Vue 3 apps deserve analytics that respect the framework’s philosophy: lightweight, composable, and developer-friendly. Most analytics tools fail on at least two of those. Typical cookie-based tools load a heavy JavaScript bundle and come with a consent banner. Product-analytics suites are designed for product teams, not indie Vue developers who want to know which pages get traffic.
Measure takes a different approach: a script of a couple of KB, zero cookies, nothing stored on the visitor’s device so no cookie banner is needed for it, and an MCP server so your AI coding tools can query your analytics directly.
Installation
Add the tracking script to your index.html (or your app shell):
<script defer src="https://lets.measure.events/api/script/YOUR_TRACKING_ID"></script>That’s it. Every page load is captured automatically, along with time on page.
Vue Router
For single-page apps using Vue Router, the page doesn’t reload on navigation — but you don’t need a composable or a router.afterEach hook. Vue Router’s history mode navigates with pushState, and the Measure script hooks pushState and popstate, so every route change and back/forward navigation is counted as a pageview.
Tracking conversions
The script is pageviews only — there’s no JavaScript API for custom events. To count signups or purchases:
- Use a destination route.
router.push('/welcome')after a signup, or land people on/thanksafter a form. That route’s pageviews are your conversion count. - Send it from your backend. Post to the REST API from your server, keeping the
mk_API key out of the browser:
// server-side only
await fetch('https://lets.measure.events/api/v1/events', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${process.env.MEASURE_API_KEY}`
},
body: JSON.stringify({ site_key: process.env.MEASURE_TRACKING_ID, path: '/events/purchase' })
})SSR considerations
Nuxt users, see our Nuxt guide.
If you’re using Vue with SSR (Vite SSR, Quasar, or a custom setup), the tracking script should only load client-side. The defer attribute handles this in most cases, but if you’re injecting scripts programmatically:
// Only run client-side
if (typeof window !== 'undefined') {
const script = document.createElement('script')
script.defer = true
script.src = 'https://lets.measure.events/api/script/YOUR_TRACKING_ID'
document.head.appendChild(script)
}Why not a typical cookie-based tool?
Three reasons Vue developers switch:
- Size. A typical analytics bundle is tens of KB of JavaScript. Measure loads a couple of KB. For Vue apps where you’ve optimized every component import, that’s a big difference.
- Privacy. Cookie-based tools usually come with a consent banner in the EU. Measure uses no cookies, stores nothing on the visitor’s device, and doesn’t store IP addresses or user-agent strings — visitors are counted with a daily-rotating salted hash. No cookie banner needed for Measure.
- Developer experience. Measure has an MCP server. Ask Cursor or Claude “what are my top pages this week?” and get a real answer from your actual data, instead of clicking through a dashboard manually.
MCP server for AI-powered analytics
This is where Measure is genuinely different. Connect the MCP server (https://lets.measure.events/mcp, authenticated with an mk_ API key) and your AI coding tools can query your analytics:
"What pages are getting the most traffic?"
"Show me referrer sources for the last 7 days"
"Has traffic increased since I launched the new landing page?"
"How much of my traffic is AI agents?"For Vue developers already using Cursor, Windsurf, or Claude Code, your analytics become part of your development workflow instead of a separate tab you forget to check.
Getting started
- Sign up at lets.measure.events — $29/month covers 40 sites, with a 14-day trial
- Add your site and get your tracking ID
- Drop the script tag into your
index.html - Optional: connect the MCP server for AI-powered queries
Total setup time: under 5 minutes. Total JavaScript added to your bundle: 0 bytes (the script loads externally with defer).
Let your agent read the numbers.
$29 a month covers 40 sites, then $0.50 a site. 14-day trial.