diff --git a/docs/platforms/javascript/guides/nextjs/configuration/build/index.mdx b/docs/platforms/javascript/guides/nextjs/configuration/build/index.mdx index 68a8f35337172d..4ea93272b98505 100644 --- a/docs/platforms/javascript/guides/nextjs/configuration/build/index.mdx +++ b/docs/platforms/javascript/guides/nextjs/configuration/build/index.mdx @@ -268,6 +268,30 @@ The route manifest is a build-time generated mapping of your Next.js App Router + + +Enables React component name tracking. When enabled, it annotates React components with data attributes that allow Sentry to track which components users interacted with in features like Session Replay and breadcrumbs. + +This option accepts an object with the following property: + +- `enabled` (boolean): Whether to enable React component annotation. Defaults to `false`. + +```javascript +withSentryConfig(nextConfig, { + reactComponentAnnotation: { + enabled: true, + }, +}); +``` + +When enabled, the Sentry Metro plugin applies `@sentry/babel-plugin-component-annotate`, which parses your application's JSX source code at build time and adds `data-sentry-component` and `data-sentry-source-file` attributes to your components. This helps identify exactly which React component was interacted with, removing ambiguity from generic element names. + + + This feature requires components to be in `.jsx` or `.tsx` file formats. Only components in your project (outside of `node_modules`) are annotated by default. + + + +