// plugins/statpx.client.ts // statpx Analytics — Nuxt 3 client plugin // Place this file in your project's /plugins/ directory // Replace YOUR_TRACKING_ID with your ID from statpx.com → Dashboard → Snippet export default defineNuxtPlugin(() => { // Set tracking ID window._stid = 'YOUR_TRACKING_ID' window._stendpoint = 'https://statpx.com' // Load tracking script const script = document.createElement('script') script.src = 'https://statpx.com/track.js' script.async = true document.head.appendChild(script) // SPA: track route changes const router = useRouter() router.afterEach(() => { // statpx track.js auto-detects pushState — no extra call needed }) }) // ─── Alternative: nuxt.config.ts approach ───────────────────────────────── // // export default defineNuxtConfig({ // app: { // head: { // script: [ // { innerHTML: "window._stid='YOUR_TRACKING_ID';window._stendpoint='https://statpx.com';", tagPosition: 'bodyClose' }, // { src: 'https://statpx.com/track.js', async: true, tagPosition: 'bodyClose' }, // ] // } // } // })