Repository: getsentry/sentry-docs
Pull request #13815: docs(js): Clarify docs on Next.js tracing setup
Author: login: chargome
Created: 2025-05-23T07:53:28Z | Merged: 2025-05-23T08:57:55Z



Diff:
diff --git a/docs/platforms/javascript/guides/nextjs/manual-setup.mdx b/docs/platforms/javascript/guides/nextjs/manual-setup.mdx
index fef4e39593acb4..8606f00a8006a3 100644
--- a/docs/platforms/javascript/guides/nextjs/manual-setup.mdx
+++ b/docs/platforms/javascript/guides/nextjs/manual-setup.mdx
@@ -87,7 +87,13 @@ export default withSentryConfig(nextConfig, {
 
 ### Initialize Sentry Client-Side and Server-Side SDKs
 
-Create three files in your application's root directory: `sentry.server.config.(js|ts)`, `sentry.edge.config.(js|ts)`, and `instrumentation-client.(js|ts)`. Add the following initialization code into each respective file:
+Create three files in your application's root directory:
+- `sentry.server.config.(js|ts)`
+- `sentry.edge.config.(js|ts)`
+- `instrumentation-client.(js|ts)`
+  - If you previously had a file called `sentry.client.config.(js|ts)`, you can safely rename this to `instrumentation-client.(js|ts)` for all Next.js versions.
+
+Add the following initialization code into each respective file:
 
 <Alert level="info" title="Note">
   These files run in different environments (browser, server, edge) and are
@@ -112,8 +118,8 @@ Sentry.init({
   // https://docs.sentry.io/platforms/javascript/configuration/options/#traces-sample-rate
   tracesSampleRate: 1.0,
   // ___PRODUCT_OPTION_END___ performance
-  // Replay may only be enabled for the client-side
   // ___PRODUCT_OPTION_START___ session-replay
+  // Replay may only be enabled for the client-side
   integrations: [Sentry.replayIntegration()],
 
   // Capture Replay for 10% of all sessions,
@@ -188,10 +194,8 @@ Sentry.init({
 });
 ```
 
-<Alert level="success" title="Tip">
-  Include your [Data Source Name](/concepts/key-terms/dsn-explainer/) (DSN)
-  directly in these files, or use a _public_ environment variable like
-  `NEXT_PUBLIC_SENTRY_DSN`.
+<Alert title="Tip">
+  Include your DSN directly in these files, or use a _public_ environment variable like `NEXT_PUBLIC_SENTRY_DSN`.
 </Alert>
 
 ### Register Sentry Server-Side SDK Initialization
@@ -210,12 +214,6 @@ export async function register() {
 }
 ```
 
-<Alert level="warning" title="Next.js version <15 only">
-  You need to enable the instrumentation hook by setting the
-  `experimental.instrumentationHook` to `true` in your `next.config.(js|mjs)`
-  file.
-</Alert>
-
 <Expandable title="Opt out of Sentry SDK bundling on client- or server-side.">
   If you want the Sentry SDK to be available on the server side and not on the
   client side, simply delete `instrumentation-client.(js|ts)`. This will prevent
diff --git a/platform-includes/performance/configure-sample-rate/javascript.nextjs.mdx b/platform-includes/performance/configure-sample-rate/javascript.nextjs.mdx
index ef9209563348ca..c0a1484e608ff9 100644
--- a/platform-includes/performance/configure-sample-rate/javascript.nextjs.mdx
+++ b/platform-includes/performance/configure-sample-rate/javascript.nextjs.mdx
@@ -1,13 +1,45 @@
-Set `tracesSampleRate` in your config files, `instrumentation-client.js`, `sentry.server.config.js`, and `sentry.edge.config.js`:
+Set `tracesSampleRate` in your config files:
+- `sentry.server.config.js`
+- `sentry.edge.config.js`:
+- `instrumentation-client.js`
+  - If you previously had a file called `sentry.client.config.(js|ts)`, you can safely rename this to `instrumentation-client.(js|ts)` for all Next.js versions.
 
-```javascript
+```javascript {tabTitle:Client} {filename:instrumentation-client.(js|ts)}
 import * as Sentry from "@sentry/nextjs";
 
 Sentry.init({
   dsn: "___PUBLIC_DSN___",
+  // We recommend adjusting this value in production, or using `tracesSampler`
+  // for finer control
+  tracesSampleRate: 1.0,
+  // ... rest of your config
+});
+
+// This export will instrument router navigations, and is only relevant if you enable tracing.
+// `captureRouterTransitionStart` is available from SDK version 9.12.0 onwards
+export const onRouterTransitionStart = Sentry.captureRouterTransitionStart;
+```
+
+```javascript {tabTitle:Server} {filename:sentry.server.config.(js|ts)}
+import * as Sentry from "@sentry/nextjs";
 
+Sentry.init({
+  dsn: "___PUBLIC_DSN___",
   // We recommend adjusting this value in production, or using `tracesSampler`
   // for finer control
   tracesSampleRate: 1.0,
+  // ... rest of your config
 });
 ```
+
+```javascript {tabTitle:Edge} {filename:sentry.edge.config.(js|ts)}
+import * as Sentry from "@sentry/nextjs";
+
+Sentry.init({
+  dsn: "___PUBLIC_DSN___",
+  // We recommend adjusting this value in production, or using `tracesSampler`
+  // for finer control
+  tracesSampleRate: 1.0,
+  // ... rest of your config
+});
+```
\ No newline at end of file


Reviews:
user: login: mydea
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-05-23T08:19:20Z
user: login: mydea
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-05-23T08:19:31Z
user: login: mydea
body: nice!
state: APPROVED
author_association: MEMBER
submitted_at: 2025-05-23T08:20:17Z
user: login: chargome
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-05-23T08:24:40Z

Review comments:
diff_hunk: @@ -1,13 +1,45 @@
-Set `tracesSampleRate` in your config files, `instrumentation-client.js`, `sentry.server.config.js`, and `sentry.edge.config.js`:
+Set `tracesSampleRate` in your config files:
+- `sentry.server.config.js`
+- `sentry.edge.config.js`:
+- `instrumentation-client.js`
+  - If you previously had file called `sentry.client.config.(js|ts)`, you can also safely rename this to `instrumentation-client.(js|ts)` for all Next.js versions.
path: platform-includes/performance/configure-sample-rate/javascript.nextjs.mdx
user: login: mydea
body: ```suggestion
  - If you previously had a file called `sentry.client.config.(js|ts)`, you can safely rename this to `instrumentation-client.(js|ts)` for all Next.js versions.
```
created_at: 2025-05-23T08:19:20Z
author_association: MEMBER
diff_hunk: @@ -87,7 +87,13 @@ export default withSentryConfig(nextConfig, {
 
 ### Initialize Sentry Client-Side and Server-Side SDKs
 
-Create three files in your application's root directory: `sentry.server.config.(js|ts)`, `sentry.edge.config.(js|ts)`, and `instrumentation-client.(js|ts)`. Add the following initialization code into each respective file:
+Create three files in your application's root directory:
+- `sentry.server.config.(js|ts)`
+- `sentry.edge.config.(js|ts)`
+- `instrumentation-client.(js|ts)`
+  - If you previously had file called `sentry.client.config.(js|ts)`, you can also safely rename this to `instrumentation-client.(js|ts)` for all Next.js versions.
path: docs/platforms/javascript/guides/nextjs/manual-setup.mdx
user: login: mydea
body: ```suggestion
  - If you previously had a file called `sentry.client.config.(js|ts)`, you can safely rename this to `instrumentation-client.(js|ts)` for all Next.js versions.
```
created_at: 2025-05-23T08:19:31Z
author_association: MEMBER
diff_hunk: @@ -1,13 +1,45 @@
-Set `tracesSampleRate` in your config files, `instrumentation-client.js`, `sentry.server.config.js`, and `sentry.edge.config.js`:
+Set `tracesSampleRate` in your config files:
+- `sentry.server.config.js`
+- `sentry.edge.config.js`:
+- `instrumentation-client.js`
+  - If you previously had file called `sentry.client.config.(js|ts)`, you can also safely rename this to `instrumentation-client.(js|ts)` for all Next.js versions.
path: platform-includes/performance/configure-sample-rate/javascript.nextjs.mdx
user: login: chargome
body: whoopsie
created_at: 2025-05-23T08:24:39Z
author_association: MEMBER

PR comments:
user: login: vercel[bot]
created_at: 2025-05-23T07:53:34Z
body: [vc]: #OszAhRr8eEXYFP2JOH7BgzCgsKpEEIke8EyKEmYsJOc=:eyJpc01vbm9yZXBvIjp0cnVlLCJ0eXBlIjoiZ2l0aHViIiwicHJvamVjdHMiOlt7Im5hbWUiOiJzZW50cnktZG9jcyIsInJvb3REaXJlY3RvcnkiOm51bGwsImluc3BlY3RvclVybCI6Imh0dHBzOi8vdmVyY2VsLmNvbS9zZW50cnkvc2VudHJ5LWRvY3MvOVc0UW80dVdjTU52b3RlcURodVJuRVBoUDdKeCIsInByZXZpZXdVcmwiOiJzZW50cnktZG9jcy1naXQtY2ctbmV4dC11cGRhdGUtY29uZmlnLnNlbnRyeS5kZXYiLCJuZXh0Q29tbWl0U3RhdHVzIjoiREVQTE9ZRUQiLCJsaXZlRmVlZGJhY2siOnsicmVzb2x2ZWQiOjAsInVucmVzb2x2ZWQiOjAsInRvdGFsIjowLCJsaW5rIjoic2VudHJ5LWRvY3MtZ2l0LWNnLW5leHQtdXBkYXRlLWNvbmZpZy5zZW50cnkuZGV2In19LHsibmFtZSI6ImRldmVsb3AtZG9jcyIsInJvb3REaXJlY3RvcnkiOm51bGwsImxpdmVGZWVkYmFjayI6eyJyZXNvbHZlZCI6MCwidW5yZXNvbHZlZCI6MCwidG90YWwiOjAsImxpbmsiOiIifSwiaW5zcGVjdG9yVXJsIjoiaHR0cHM6Ly92ZXJjZWwuY29tL3NlbnRyeS9kZXZlbG9wLWRvY3MvMm5IczRzQWRlZnp5NTdSTlpLVTl2WjduQmdNaSIsIm5leHRDb21taXRTdGF0dXMiOiJJR05PUkVEIiwicHJldmlld1VybCI6ImRldmVsb3AtZG9jcy1naXQtY2ctbmV4dC11cGRhdGUtY29uZmlnLnNlbnRyeS5kZXYifSx7Im5hbWUiOiJjaGFuZ2Vsb2ciLCJyb290RGlyZWN0b3J5IjoiYXBwcy9jaGFuZ2Vsb2ciLCJsaXZlRmVlZGJhY2siOnsicmVzb2x2ZWQiOjAsInVucmVzb2x2ZWQiOjAsInRvdGFsIjowLCJsaW5rIjoiIn0sImluc3BlY3RvclVybCI6Imh0dHBzOi8vdmVyY2VsLmNvbS9zZW50cnkvY2hhbmdlbG9nLzRWU1U0QmJ2MW9tOU14MzFTa3NqbzRFQUtvaG8iLCJuZXh0Q29tbWl0U3RhdHVzIjoiSUdOT1JFRCIsInByZXZpZXdVcmwiOiJjaGFuZ2Vsb2ctZ2l0LWNnLW5leHQtdXBkYXRlLWNvbmZpZy5zZW50cnkuZGV2In1dfQ==
**The latest updates on your projects**. Learn more about [Vercel for Git ↗︎](https://vercel.link/github-learn-more)

| Name | Status | Preview | Comments | Updated (UTC) |
| :--- | :----- | :------ | :------- | :------ |
| **sentry-docs** | ✅ Ready ([Inspect](https://vercel.com/sentry/sentry-docs/9W4Qo4uWcMNvoteqDhuRnEPhP7Jx)) | [Visit Preview](https://sentry-docs-git-cg-next-update-config.sentry.dev) | 💬 [**Add feedback**](https://vercel.live/open-feedback/sentry-docs-git-cg-next-update-config.sentry.dev?via=pr-comment-feedback-link) | May 23, 2025 8:55am |

<details><summary>2 Skipped Deployments</summary>

| Name | Status | Preview | Comments | Updated (UTC) |
| :--- | :----- | :------ | :------- | :------ |
| **changelog** | ⬜️ Ignored ([Inspect](https://vercel.com/sentry/changelog/4VSU4Bbv1om9Mx31Sksjo4EAKoho)) | [Visit Preview](https://changelog-git-cg-next-update-config.sentry.dev) |  | May 23, 2025 8:55am |
| **develop-docs** | ⬜️ Ignored ([Inspect](https://vercel.com/sentry/develop-docs/2nHs4sAdefzy57RNZKU9vZ7nBgMi)) | [Visit Preview](https://develop-docs-git-cg-next-update-config.sentry.dev) |  | May 23, 2025 8:55am |
</details>




author_association: NONE
user: login: codecov[bot]
created_at: 2025-05-23T07:58:11Z
body: ## [Bundle](https://app.codecov.io/gh/getsentry/sentry-docs/pull/13815?dropdown=bundle) Report

Changes will decrease total bundle size by 15 bytes (-0.0%) :arrow_down:. This is within the [configured](https://docs.codecov.com/docs/javascript-bundle-analysis#main-features) threshold :white_check_mark:

<details><summary>Detailed changes</summary>

| Bundle name | Size | Change |
| ----------- | ---- | ------ |
| sentry-docs-server-cjs | 11.2MB | -9 bytes (-0.0%) :arrow_down: |
| sentry-docs-client-array-push | 9.51MB | -6 bytes (-0.0%) :arrow_down: |

</details>

### Affected Assets, Files, and Routes:

<details>
<summary>view changes for bundle: sentry-docs-server-cjs</summary>

#### **Assets Changed:**
| Asset Name | Size Change | Total Size | Change (%) |
| ---------- | ----------- | ---------- | ---------- |
| ```1729.js``` | -3 bytes | 1.75MB | -0.0%  |
| ```../instrumentation.js``` | -3 bytes | 1.08MB | -0.0%  |
| ```9523.js``` | -3 bytes | 1.05MB | -0.0%  |










</details>

<details>
<summary>view changes for bundle: sentry-docs-client-array-push</summary>

#### **Assets Changed:**
| Asset Name | Size Change | Total Size | Change (%) |
| ---------- | ----------- | ---------- | ---------- |
| ```static/chunks/pages/_app-*.js``` | -3 bytes | 868.7kB | -0.0%  |
| ```static/chunks/8165-*.js``` | -3 bytes | 410.1kB | -0.0%  |
| **```static/LMeWGwKuHrBEjdKT4rODV/_buildManifest.js```** _(New)_ | 578 bytes | 578 bytes | 100.0% :rocket: |
| **```static/LMeWGwKuHrBEjdKT4rODV/_ssgManifest.js```** _(New)_ | 77 bytes | 77 bytes | 100.0% :rocket: |
| ~~**```static/IOFB41EBkVpY3uhSw5erU/_buildManifest.js```**~~ _(Deleted)_ | -578 bytes | 0 bytes | -100.0% :wastebasket: |
| ~~**```static/IOFB41EBkVpY3uhSw5erU/_ssgManifest.js```**~~ _(Deleted)_ | -77 bytes | 0 bytes | -100.0% :wastebasket: |
















</details>

author_association: NONE