Skip to content

Commit 530621e

Browse files
committed
feat(docs): add vercel analytics
1 parent 3b8ed40 commit 530621e

File tree

3 files changed

+104
-5
lines changed

3 files changed

+104
-5
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { inject, pageview } from '@vercel/analytics'
2+
import { injectSpeedInsights } from '@vercel/speed-insights'
3+
4+
export default defineNuxtPlugin(() => {
5+
if (import.meta.dev) return
6+
7+
const nuxtApp = useNuxtApp()
8+
const route = useRoute()
9+
const speedInsights = injectSpeedInsights({
10+
route: route.matched[0]?.path || route.path,
11+
framework: 'nuxt',
12+
})
13+
14+
onNuxtReady(() => {
15+
inject({
16+
disableAutoTrack: true,
17+
framework: 'nuxt',
18+
})
19+
pageview({
20+
route: route.matched[0]?.path || route.path,
21+
path: route.path,
22+
})
23+
})
24+
// On navigation to a new page
25+
nuxtApp.hooks.hook('page:finish', () => {
26+
pageview({
27+
route: route.matched[0]?.path || route.path,
28+
path: route.path,
29+
})
30+
speedInsights?.setRoute(route.matched[0]?.path || route.path)
31+
})
32+
})

apps/docs/package.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,20 @@
1616
"lint:fix": "eslint . --fix"
1717
},
1818
"dependencies": {
19-
"@rollup/plugin-yaml": "^4.1.2",
20-
"@ai-sdk/vue": "3.0.0-beta.105",
21-
"shiki-stream": "^0.1.2",
2219
"@ai-sdk/mcp": "^0.0.8",
20+
"@ai-sdk/vue": "3.0.0-beta.105",
21+
"@nuxtjs/mcp-toolkit": "workspace:*",
22+
"@rollup/plugin-yaml": "^4.1.2",
23+
"@vercel/analytics": "^1.5.0",
24+
"@vercel/speed-insights": "^1.2.0",
2325
"ai": "6.0.0-beta.105",
2426
"better-sqlite3": "^12.4.1",
2527
"docus": "latest",
2628
"motion-v": "^1.7.4",
2729
"nuxt": "^4.2.1",
28-
"@nuxtjs/mcp-toolkit": "workspace:*",
2930
"nuxt-studio": "1.0.0-alpha.2",
30-
"shaders": "^2.1.10"
31+
"shaders": "^2.1.10",
32+
"shiki-stream": "^0.1.2"
3133
},
3234
"devDependencies": {
3335
"@nuxt/eslint-config": "^1.10.0",

pnpm-lock.yaml

Lines changed: 65 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)