From 0e00888387689305629b30dd75122bb6c9e2dce8 Mon Sep 17 00:00:00 2001 From: s1gr1d <32902192+s1gr1d@users.noreply.github.com> Date: Fri, 12 Jun 2026 11:08:00 +0200 Subject: [PATCH] docs(data-collection): Add init snippet guidelines --- .../client/data-collection/index.mdx | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/develop-docs/sdk/foundations/client/data-collection/index.mdx b/develop-docs/sdk/foundations/client/data-collection/index.mdx index 16f1e5769342ca..beb762de7be45e 100644 --- a/develop-docs/sdk/foundations/client/data-collection/index.mdx +++ b/develop-docs/sdk/foundations/client/data-collection/index.mdx @@ -2,12 +2,15 @@ title: Data Collection description: Configuration for what data SDKs collect by default, including technical context, PII, and sensitive data. spec_id: sdk/foundations/client/data-collection -spec_version: 0.3.0 +spec_version: 0.4.0 spec_status: candidate spec_depends_on: - id: sdk/foundations/client version: ">=1.0.0" spec_changelog: + - version: 0.4.0 + date: 2026-06-12 + summary: Added documentation requirements for default behavior and setup snippet opt-out comment with link to full dataCollection docs. - version: 0.3.0 date: 2026-06-05 summary: Promoted to candidate following the initial JavaScript SDK implementation. Version stays `0.x` until the contract is frozen at `stable`. @@ -106,6 +109,26 @@ The three sensitivity levels determine whether data is collected by default: - **PII Data**: SDKs **SHOULD** automatically populate user identity fields (`user.*`) by default. Users can set the `userInfo` option to `false` to opt out. See [`dataCollection` Options](#datacollection-options). - **Sensitive Data**: SDKs **MUST** never send sensitive values through automatic instrumentation. Values for keys matching the denylist **MUST** be replaced with `"[Filtered]"`; key names are always retained. Users can use `beforeSend` (or equivalent) to remove or redact keys if needed. See [Sensitive Denylist](#sensitive-denylist). +SDK documentation **MUST** document the default value and behavior of each `dataCollection` option. + + + + + +### Setup Snippet Opt-Out Comment + +All SDK initialization code snippets (including documentation examples, onboarding flows, and CLI wizard output) **MUST** include a commented-out `dataCollection` override that disables `userInfo` and `httpBodies`. +The comment **MUST** include a URL linking to the full `dataCollection` documentation matching the specific platform or guide. + +```pseudocode +init({ + dsn: "...", + // To disable sending user data and HTTP bodies, uncomment the line below. For more info visit: + // https://docs.sentry.io/platforms/javascript/configuration/options/#dataCollection + // dataCollection: { userInfo: false, httpBodies: [] }, +}) +``` +