Next.js 16+ · Directive
instrumentation-client
Use instrumentation-client.js or .ts for client monitoring, analytics, error tracking, and other side effects before the app becomes interactive. Put it at the app root or in src; export onRouterTransitionStart to observe App Router navigation starts.
Last updated
- Since
- v15.3
Syntax
instrumentation-client.js|ts
export function onRouterTransitionStart(url: string, navigationType: 'push' | 'replace' | 'traverse') { }In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
onRouterTransitionStartinstrumentationClientRouterTransitionEventsRouterTransitionStartEventRouterTransitionTypeuseReportWebVitalsCustom Polyfills