File tree Expand file tree Collapse file tree 3 files changed +104
-5
lines changed
Expand file tree Collapse file tree 3 files changed +104
-5
lines changed Original file line number Diff line number Diff line change 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+ } )
Original file line number Diff line number Diff line change 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" ,
You can’t perform that action at this time.
0 commit comments