Skip to main content

[JavaScript] Does the SDK set cookies?

Issue

I have data privacy concerns and need to know whether the Sentry JavaScript SDK sets cookies in my application. I am not asking about cookies used when signing into the Sentry Web App.

Applies To

  • All SaaS Customers and Self-Hosted Users

  • JavaScript SDK

  • Data privacy

  • SDK Setup

Resolution

The JavaScript SDKs do not set cookies in your application. That is separate from cookies used by the Sentry Web App when you sign in.

The SDK can still read and attach cookie values from requests as event context, depending on your configuration.

By default, the Sentry SDK does not send cookies. If you pass a dataCollection object, cookies are collected (with sensitive values scrubbed) unless you opt out:

Sentry.init({
  dsn: "___PUBLIC_DSN___",
  dataCollection: {
    cookies: false,
  },
});

You can also allow or deny specific cookie names with { allow: [...] } or { deny: [...] }. Without dataCollection, the older way to include cookies was sendDefaultPii: true (deprecated as of version 10.54.0).

On server runtimes, incoming request cookies may also be attached via integrations such as RequestData. Prefer dataCollection.cookies to control cookie collection going forward.

Did this answer your question?