Repository: getsentry/sentry
Pull request #89721: feat(onboarding): add sendDefaultPii: true to all JS platforms
Author: login: smeubank
Labels: name: Scope: Frontend
description: Automatically applied to PRs that change frontend components
Created: 2025-04-16T08:50:47Z | Merged: 2025-04-24T10:11:20Z

sendDefaultPii: true added to all



Diff:
diff --git a/static/app/gettingStartedDocs/javascript/angular.tsx b/static/app/gettingStartedDocs/javascript/angular.tsx
index 84e1bf586eaeb1..677fb763120842 100644
--- a/static/app/gettingStartedDocs/javascript/angular.tsx
+++ b/static/app/gettingStartedDocs/javascript/angular.tsx
@@ -149,7 +149,12 @@ bootstrapApplication(appConfig, AppComponent)
 
   const config = buildSdkConfig({
     params,
-    staticParts: [`dsn: "${params.dsn.public}"`],
+    staticParts: [
+      `dsn: "${params.dsn.public}"`,
+      `// Setting this option to true will send default PII data to Sentry.
+      // For example, automatic IP address collection on events
+      sendDefaultPii: true`,
+    ],
     getIntegrations,
     getDynamicParts,
   });
diff --git a/static/app/gettingStartedDocs/javascript/astro.tsx b/static/app/gettingStartedDocs/javascript/astro.tsx
index 4a87846c82fb66..e87701b1e798b7 100644
--- a/static/app/gettingStartedDocs/javascript/astro.tsx
+++ b/static/app/gettingStartedDocs/javascript/astro.tsx
@@ -47,6 +47,9 @@ export default defineConfig({
       replaysSessionSampleRate: 0,
       replaysOnErrorSampleRate: 0,`
       }
+      // Setting this option to true will send default PII data to Sentry.
+      // For example, automatic IP address collection on events
+      sendDefaultPii: true,
       sourceMapsUploadOptions: {
         project: "${params.projectSlug}",
         authToken: process.env.SENTRY_AUTH_TOKEN,
diff --git a/static/app/gettingStartedDocs/javascript/ember.tsx b/static/app/gettingStartedDocs/javascript/ember.tsx
index 1f746050826c02..b812c111230c60 100644
--- a/static/app/gettingStartedDocs/javascript/ember.tsx
+++ b/static/app/gettingStartedDocs/javascript/ember.tsx
@@ -91,7 +91,12 @@ const getDynamicParts = (params: Params): string[] => {
 const getSdkSetupSnippet = (params: Params) => {
   const config = buildSdkConfig({
     params,
-    staticParts: [`dsn: "${params.dsn.public}"`],
+    staticParts: [
+      `dsn: "${params.dsn.public}"`,
+      `// Setting this option to true will send default PII data to Sentry.
+      // For example, automatic IP address collection on events
+      sendDefaultPii: true`,
+    ],
     getIntegrations,
     getDynamicParts,
   });
diff --git a/static/app/gettingStartedDocs/javascript/gatsby.tsx b/static/app/gettingStartedDocs/javascript/gatsby.tsx
index 161c7dcd691fe2..01a23b09e75dd0 100644
--- a/static/app/gettingStartedDocs/javascript/gatsby.tsx
+++ b/static/app/gettingStartedDocs/javascript/gatsby.tsx
@@ -94,7 +94,12 @@ const getDynamicParts = (params: Params): string[] => {
 const getSdkSetupSnippet = (params: Params) => {
   const config = buildSdkConfig({
     params,
-    staticParts: [`dsn: "${params.dsn.public}"`],
+    staticParts: [
+      `dsn: "${params.dsn.public}"`,
+      `// Setting this option to true will send default PII data to Sentry.
+      // For example, automatic IP address collection on events
+      sendDefaultPii: true`,
+    ],
     getIntegrations,
     getDynamicParts,
   });
diff --git a/static/app/gettingStartedDocs/javascript/javascript.tsx b/static/app/gettingStartedDocs/javascript/javascript.tsx
index 613f79f70d1038..ad3b8e11d1ccb8 100644
--- a/static/app/gettingStartedDocs/javascript/javascript.tsx
+++ b/static/app/gettingStartedDocs/javascript/javascript.tsx
@@ -255,7 +255,12 @@ const getDynamicParts = (params: Params): string[] => {
 const getSdkSetupSnippet = (params: Params) => {
   const config = buildSdkConfig({
     params,
-    staticParts: [`dsn: "${params.dsn.public}"`],
+    staticParts: [
+      `dsn: "${params.dsn.public}"`,
+      `// Setting this option to true will send default PII data to Sentry.
+      // For example, automatic IP address collection on events
+      sendDefaultPii: true`,
+    ],
     getIntegrations,
     getDynamicParts,
   });
@@ -728,6 +733,9 @@ Sentry.init({
   tracesSampleRate: 1.0,
   // Set \`tracePropagationTargets\` to control for which URLs distributed tracing should be enabled
   tracePropagationTargets: ["localhost", /^https:\/\/yourserver\.io\/api/],
+  // Setting this option to true will send default PII data to Sentry.
+  // For example, automatic IP address collection on events
+  sendDefaultPii: true,
 });
 `,
           additionalInfo: tct(
@@ -762,6 +770,9 @@ Sentry.init({
   dsn: "${params.dsn.public}",
   integrations: [Sentry.browserTracingIntegration()],
   tracePropagationTargets: ["https://myproject.org", /^\/api\//],
+  // Setting this option to true will send default PII data to Sentry.
+  // For example, automatic IP address collection on events
+  sendDefaultPii: true,
 });
 `,
         },
diff --git a/static/app/gettingStartedDocs/javascript/react.tsx b/static/app/gettingStartedDocs/javascript/react.tsx
index c9472d10928fdf..040c2608dc598d 100644
--- a/static/app/gettingStartedDocs/javascript/react.tsx
+++ b/static/app/gettingStartedDocs/javascript/react.tsx
@@ -95,7 +95,12 @@ const getIntegrations = (params: Params): string[] => {
 const getSdkSetupSnippet = (params: Params) => {
   const config = buildSdkConfig({
     params,
-    staticParts: [`dsn: "${params.dsn.public}"`],
+    staticParts: [
+      `dsn: "${params.dsn.public}"`,
+      `// Setting this option to true will send default PII data to Sentry.
+      // For example, automatic IP address collection on events
+      sendDefaultPii: true`,
+    ],
     getIntegrations,
     getDynamicParts,
   });
diff --git a/static/app/gettingStartedDocs/javascript/solid.tsx b/static/app/gettingStartedDocs/javascript/solid.tsx
index 57551b2037906d..96de739a5050b4 100644
--- a/static/app/gettingStartedDocs/javascript/solid.tsx
+++ b/static/app/gettingStartedDocs/javascript/solid.tsx
@@ -97,7 +97,12 @@ const getDynamicParts = (params: Params): string[] => {
 const getSdkSetupSnippet = (params: Params) => {
   const config = buildSdkConfig({
     params,
-    staticParts: [`dsn: "${params.dsn.public}"`],
+    staticParts: [
+      `dsn: "${params.dsn.public}"`,
+      `// Setting this option to true will send default PII data to Sentry.
+      // For example, automatic IP address collection on events
+      sendDefaultPii: true`,
+    ],
     getIntegrations,
     getDynamicParts,
   });
diff --git a/static/app/gettingStartedDocs/javascript/solidstart.tsx b/static/app/gettingStartedDocs/javascript/solidstart.tsx
index b525b58661121b..1aac2b6db63213 100644
--- a/static/app/gettingStartedDocs/javascript/solidstart.tsx
+++ b/static/app/gettingStartedDocs/javascript/solidstart.tsx
@@ -97,7 +97,12 @@ const getDynamicParts = (params: Params): string[] => {
 const getSdkClientSetupSnippet = (params: Params) => {
   const config = buildSdkConfig({
     params,
-    staticParts: [`dsn: "${params.dsn.public}"`],
+    staticParts: [
+      `dsn: "${params.dsn.public}"`,
+      `// Setting this option to true will send default PII data to Sentry.
+      // For example, automatic IP address collection on events
+      sendDefaultPii: true`,
+    ],
     getIntegrations,
     getDynamicParts,
   });
@@ -139,6 +144,9 @@ Sentry.init({
           profilesSampleRate: 1.0,`
       : ''
   }
+  // Setting this option to true will send default PII data to Sentry.
+  // For example, automatic IP address collection on events
+  sendDefaultPii: true,
 });
 `;
 
diff --git a/static/app/gettingStartedDocs/javascript/svelte.tsx b/static/app/gettingStartedDocs/javascript/svelte.tsx
index 9f9b521d42195e..b3b0dd4757de35 100644
--- a/static/app/gettingStartedDocs/javascript/svelte.tsx
+++ b/static/app/gettingStartedDocs/javascript/svelte.tsx
@@ -94,7 +94,12 @@ const getDynamicParts = (params: Params): string[] => {
 const getSdkSetupSnippet = (params: Params, isVersion5: boolean) => {
   const config = buildSdkConfig({
     params,
-    staticParts: [`dsn: "${params.dsn.public}"`],
+    staticParts: [
+      `dsn: "${params.dsn.public}"`,
+      `// Setting this option to true will send default PII data to Sentry.
+      // For example, automatic IP address collection on events
+      sendDefaultPii: true`,
+    ],
     getIntegrations,
     getDynamicParts,
   });
diff --git a/static/app/gettingStartedDocs/javascript/tanstackstart-react.tsx b/static/app/gettingStartedDocs/javascript/tanstackstart-react.tsx
index 10548c6ac08970..14d2892bda1ed7 100644
--- a/static/app/gettingStartedDocs/javascript/tanstackstart-react.tsx
+++ b/static/app/gettingStartedDocs/javascript/tanstackstart-react.tsx
@@ -161,6 +161,10 @@ Sentry.init({
   replaysOnErrorSampleRate: 1.0,`
       : ''
   }
+
+  // Setting this option to true will send default PII data to Sentry.
+  // For example, automatic IP address collection on events
+  sendDefaultPii: true,
 });
 
 hydrateRoot(document, <StartClient router={router} />);`,
@@ -193,6 +197,10 @@ Sentry.init({
   tracesSampleRate: 1.0,`
       : ''
   }
+
+  // Setting this option to true will send default PII data to Sentry.
+  // For example, automatic IP address collection on events
+  sendDefaultPii: true,
 });`,
             },
           ],
diff --git a/static/app/gettingStartedDocs/javascript/vue.tsx b/static/app/gettingStartedDocs/javascript/vue.tsx
index 239a702fb5f92e..e5d51a278190d9 100644
--- a/static/app/gettingStartedDocs/javascript/vue.tsx
+++ b/static/app/gettingStartedDocs/javascript/vue.tsx
@@ -110,6 +110,9 @@ const getSentryInitLayout = (params: Params, siblingOption: string): string => {
     staticParts: [
       `${siblingOption === VueVersion.VUE2 ? 'Vue' : 'app'}`,
       `dsn: "${params.dsn.public}"`,
+      `// Setting this option to true will send default PII data to Sentry.
+      // For example, automatic IP address collection on events
+      sendDefaultPii: true`,
     ],
     getIntegrations,
     getDynamicParts,
diff --git a/static/app/gettingStartedDocs/node/cloudflare-pages.tsx b/static/app/gettingStartedDocs/node/cloudflare-pages.tsx
index 42c5424459c508..3d37a7b400df6d 100644
--- a/static/app/gettingStartedDocs/node/cloudflare-pages.tsx
+++ b/static/app/gettingStartedDocs/node/cloudflare-pages.tsx
@@ -41,6 +41,10 @@ export const onRequest = [
     // Learn more at
     // https://docs.sentry.io/platforms/javascript/configuration/options/#traces-sample-rate
     tracesSampleRate: 1.0,
+
+    // Setting this option to true will send default PII data to Sentry.
+    // For example, automatic IP address collection on events
+    sendDefaultPii: true,
   })),
   // Add more middlewares here
 ];`;
diff --git a/static/app/gettingStartedDocs/node/cloudflare-workers.tsx b/static/app/gettingStartedDocs/node/cloudflare-workers.tsx
index d627ee23973db9..3b82122170ddbe 100644
--- a/static/app/gettingStartedDocs/node/cloudflare-workers.tsx
+++ b/static/app/gettingStartedDocs/node/cloudflare-workers.tsx
@@ -39,6 +39,10 @@ export default Sentry.withSentry(
     // Learn more at
     // https://docs.sentry.io/platforms/javascript/configuration/options/#traces-sample-rate
     tracesSampleRate: 1.0,
+
+    // Setting this option to true will send default PII data to Sentry.
+    // For example, automatic IP address collection on events
+    sendDefaultPii: true,
   }),
   {
     async fetch(request, env, ctx) {
diff --git a/static/app/gettingStartedDocs/node/node.tsx b/static/app/gettingStartedDocs/node/node.tsx
index 6cc9588f45883b..068bb51021ebce 100644
--- a/static/app/gettingStartedDocs/node/node.tsx
+++ b/static/app/gettingStartedDocs/node/node.tsx
@@ -196,6 +196,10 @@ Sentry.init({
   // of transactions for performance monitoring.
   // We recommend adjusting this value in production
   tracesSampleRate: 1.0,
+
+  // Setting this option to true will send default PII data to Sentry.
+  // For example, automatic IP address collection on events
+  sendDefaultPii: true,
 });
 `,
             },
diff --git a/static/app/utils/gettingStartedDocs/node.tsx b/static/app/utils/gettingStartedDocs/node.tsx
index 7b4c238859b5e8..176128b89a497d 100644
--- a/static/app/utils/gettingStartedDocs/node.tsx
+++ b/static/app/utils/gettingStartedDocs/node.tsx
@@ -197,6 +197,10 @@ Sentry.init({
     profileLifecycle: 'trace',`
       : ''
   }
+
+  // Setting this option to true will send default PII data to Sentry.
+  // For example, automatic IP address collection on events
+  sendDefaultPii: true,
   });${
     params.isProfilingSelected &&
     params.profilingOptions?.defaultProfilingMode === 'continuous'
@@ -279,6 +283,10 @@ Sentry.init({
   // Set sampling rate for profiling - this is evaluated only once per SDK.init call
   profilesSampleRate: 1.0,`
   }
+
+  // Setting this option to true will send default PII data to Sentry.
+  // For example, automatic IP address collection on events
+  sendDefaultPii: true,
 });${
                 params.profilingOptions?.defaultProfilingMode === 'continuous' &&
                 profilingLifecycle === 'trace'


Reviews:
user: login: priscilawebdev
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-17T08:24:29Z
user: login: priscilawebdev
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-17T08:25:26Z
user: login: smeubank
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-17T08:30:11Z
user: login: smeubank
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-17T08:34:33Z
user: login: mydea
body: LGTM! we can still tweak this in a follow up.
state: APPROVED
author_association: MEMBER
submitted_at: 2025-04-23T07:44:51Z

Review comments:
diff_hunk: @@ -149,7 +149,12 @@ bootstrapApplication(appConfig, AppComponent)
 
   const config = buildSdkConfig({
     params,
-    staticParts: [`dsn: "${params.dsn.public}"`],
+    staticParts: [
+      `dsn: "${params.dsn.public}"`,
+      `// Setting this option to true will send default PII data to Sentry.
+      // For example, automatic IP address collection on events
+      sendDefaultPii: true`,
path: static/app/gettingStartedDocs/javascript/angular.tsx
user: login: priscilawebdev
body: since we have the same text + property everywhere, what do you think about creating a reusable const and just reuse it everywhere where we need?
created_at: 2025-04-17T08:24:26Z
author_association: MEMBER
diff_hunk: @@ -196,6 +196,10 @@ Sentry.init({
   // of transactions for performance monitoring.
   // We recommend adjusting this value in production
   tracesSampleRate: 1.0,
+
path: static/app/gettingStartedDocs/node/node.tsx
user: login: priscilawebdev
body: don't we want to display this for the other node platforms?

![image](https://github.com/user-attachments/assets/f3c77d1c-a0d2-42f3-b3a3-d8301db19cb9)

created_at: 2025-04-17T08:25:18Z
author_association: MEMBER
diff_hunk: @@ -149,7 +149,12 @@ bootstrapApplication(appConfig, AppComponent)
 
   const config = buildSdkConfig({
     params,
-    staticParts: [`dsn: "${params.dsn.public}"`],
+    staticParts: [
+      `dsn: "${params.dsn.public}"`,
+      `// Setting this option to true will send default PII data to Sentry.
+      // For example, automatic IP address collection on events
+      sendDefaultPii: true`,
path: static/app/gettingStartedDocs/javascript/angular.tsx
user: login: smeubank
body: it's just easier effort to not do it, but I am not against. Was more just interested in shipping this as a quick fix. Later we need to add docs reference. Maybe then someone can look into abstracting this more

for now i think it's scope creep
created_at: 2025-04-17T08:30:10Z
author_association: CONTRIBUTOR
diff_hunk: @@ -196,6 +196,10 @@ Sentry.init({
   // of transactions for performance monitoring.
   // We recommend adjusting this value in production
   tracesSampleRate: 1.0,
+
path: static/app/gettingStartedDocs/node/node.tsx
user: login: smeubank
body: it already is for all of them, because they do use some shared snippet like you suggested for the browser platforms :D . Nest.js for example

![image](https://github.com/user-attachments/assets/16be7c63-cb37-4ed8-8f34-be2ba475b213)

created_at: 2025-04-17T08:34:33Z
author_association: CONTRIBUTOR

PR comments:
user: login: priscilawebdev
created_at: 2025-04-17T08:20:27Z
body: should we add this to solidStart too? I cannot see this change there

![image](https://github.com/user-attachments/assets/2f7dffe2-16ba-4821-8b1f-0a7fe2c04f98)

author_association: MEMBER
user: login: priscilawebdev
created_at: 2025-04-17T08:22:36Z
body: same for tanStack:

![image](https://github.com/user-attachments/assets/8a824782-8895-4b19-b1c0-307c18cbce82)

author_association: MEMBER
user: login: priscilawebdev
created_at: 2025-04-17T08:23:10Z
body: should we add it to the browser javascript too?

![image](https://github.com/user-attachments/assets/0a3a068b-b879-4b8a-aaee-85f2540f5294)

author_association: MEMBER
user: login: smeubank
created_at: 2025-04-17T08:28:43Z
body: > should we add this to solidStart too? I cannot see this change there


oh you are right, i though we had a wizard there. I will add it
author_association: CONTRIBUTOR
user: login: smeubank
created_at: 2025-04-17T08:37:16Z
body: > same for tanStack:

it is there, your screenshot is the config not the init

![image](https://github.com/user-attachments/assets/4b7c62d0-7ab8-45eb-b07b-157b582f3095)


author_association: CONTRIBUTOR
user: login: priscilawebdev
created_at: 2025-04-22T10:02:38Z
body: should we use types for the PRs title as described in our [guidelines](https://develop.sentry.dev/engineering-practices/commit-messages/#commit-message-format)? 
author_association: MEMBER
user: login: priscilawebdev
created_at: 2025-04-22T10:07:52Z
body: shouldn't we add `sendDefaultPii:true` here too? https://github.com/getsentry/sentry/blob/b4384660b573b384ca8a6eec4da5c8a1db8bbc0a/static/app/gettingStartedDocs/javascript/javascript.tsx#L350-L393
author_association: MEMBER
user: login: priscilawebdev
created_at: 2025-04-22T10:14:07Z
body: do we want to have this property in cloudfare pages too? 
![image](https://github.com/user-attachments/assets/2e962047-9617-4108-8e73-691e6b76256c)

author_association: MEMBER
user: login: priscilawebdev
created_at: 2025-04-22T10:15:32Z
body: do we want to add this property to cloudfare workers too? 
![image](https://github.com/user-attachments/assets/ee4b78c3-b7d3-42d4-8e56-5ee3549fe09f)

author_association: MEMBER
user: login: smeubank
created_at: 2025-04-24T09:47:00Z
body: fixed title, and added for cloudflare project tyes as well, merging. Other fixes are easy to do another PR
author_association: CONTRIBUTOR
user: login: codecov[bot]
created_at: 2025-04-24T09:52:15Z
body: ## [Codecov](https://app.codecov.io/gh/getsentry/sentry/pull/89721?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry) Report
All modified and coverable lines are covered by tests :white_check_mark:

:white_check_mark: All tests successful. No failed tests found.

<details><summary>Additional details and impacted files</summary>


```diff
@@             Coverage Diff             @@
##           master   #89721       +/-   ##
===========================================
+ Coverage   33.05%   87.71%   +54.65%     
===========================================
  Files        8680    10181     +1501     
  Lines      481952   573324    +91372     
  Branches    22688    22631       -57     
===========================================
+ Hits       159332   502894   +343562     
+ Misses     322178    70002   -252176     
+ Partials      442      428       -14     
```

</details>
author_association: NONE