Official agent skill

Sentry Browser SDK

by getsentry in getsentry/sentry-for-ai

Full Sentry SDK setup for browser JavaScript. An agent skill from getsentry/sentry-for-ai.

OfficialApache-2.0Auto-check: notesFrontend & Design

Install Sentry Browser SDK

skills CLI
$ npx skills add getsentry/sentry-for-ai --skill sentry-browser-sdk -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install getsentry/sentry-for-ai sentry-browser-sdk --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/getsentry/sentry-for-ai.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills-legacy/sentry-browser-sdk .claude/skills/sentry-browser-sdk && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
sentry-browser-sdk
GitHub stars
268
Token cost
~6.5k tokens
SKILL.md length
1,809 words
Files
7 (incl. references)
Skills in repo
32
Repo updated
First seen
Licence
Apache-2.0

At a glance

Full Sentry SDK setup for browser JavaScript. An agent skill from getsentry/sentry-for-ai.

  • Works in 4 steps: Detect → Recommend → Guide → …
  • Asked to add Sentry to a website
  • SKILL.md covers Invoke This Skill When, Phase 1: Detect, Phase 2: Recommend and Phase 3: Guide, plus 4 more sections
  • Calls npx, npm and yarn; reaches docs.sentry.io and browser.sentry-cdn.com; needs SENTRY_AUTH_TOKEN

What it does

Sentry Browser SDK is an agent skill from getsentry/sentry-for-ai, published by the product's own GitHub organization. Full Sentry SDK setup for browser JavaScript. Use when asked to "add Sentry to a website", "install @sentry/browser", or configure error monitoring, tracing, session replay, or logging for vanilla JavaScript, jQuery, static sites, or WordPress.

Its SKILL.md is about 6.5k tokens, which your agent loads only when the skill is triggered. The skill folder holds 7 other files, including reference files (for example `references/error-monitoring.md`, `references/logging.md` and `references/profiling.md`).

It sits in Frontend & Design, covering Static sites and blogs. It works with Sentry, JavaScript, WordPress and Svelte. The repository describes itself as: Teach your AI coding assistant how to use Sentry - setup, debugging, alerts, and more. The licence is Apache-2.0.

When your agent uses it

  • Asked to add Sentry to a website
  • Install @sentry/browser
  • Configure error monitoring
  • Logging for vanilla JavaScript

Example prompts

  • “add Sentry to a website”
  • “install @sentry/browser”
  • “/sentry-browser-sdk”

Requirements

  • Node.js
  • A credential in SENTRY_AUTH_TOKEN

Workflow steps

4 steps, taken from the step headings in SKILL.md.

  1. Detect
  2. Recommend
  3. Guide
  4. Cross-Link

What it can do on your machine

Read from SKILL.md and the folder at commit d8fd106. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • npx
    • npm
    • yarn
    • pnpm

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • docs.sentry.io
    • browser.sentry-cdn.com
    • js.sentry-cdn.com
    • o0.ingest.sentry.io

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • SENTRY_AUTH_TOKEN

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Sentry Browser SDK loads about 6.5k tokens when it runs, and up to ~30k if it reads all its reference files. Until then it costs about 66 tokens; SKILL.md has 1,809 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~66
When it runs · the whole SKILL.md, loaded when a task matches
~6.5k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~30k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NoteMentions a .env fileSKILL.md:321
    Add `.env` for auth (never commit):

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from getsentry/sentry-for-ai at commit d8fd106, republished under its Apache-2.0 licence (© getsentry). 1,809 words, ~6,508 tokens.

Download SKILL.mdSave it as .claude/skills/sentry-browser-sdk/SKILL.md (or your agent's skills folder). This skill also uses 6 other files; get the full folder from GitHub.
name
sentry-browser-sdk
description
Full Sentry SDK setup for browser JavaScript. Use when asked to "add Sentry to a website", "install @sentry/browser", or configure error monitoring, tracing, session replay, or logging for vanilla JavaScript, jQuery, static sites, or WordPress.
license
Apache-2.0
category
sdk-setup
parent
sentry-sdk-setup
disable-model-invocation
true

All Skills > SDK Setup > Browser SDK

Sentry Browser SDK

Opinionated wizard that scans your project and guides you through complete Sentry setup for browser JavaScript — vanilla JS, jQuery, static sites, WordPress, and any JS project without a framework-specific SDK.

Invoke This Skill When

  • User asks to "add Sentry to a website" or set up Sentry for plain JavaScript
  • User wants to install @sentry/browser or configure the Loader Script
  • User has a WordPress, Shopify, Squarespace, or static HTML site
  • User wants error monitoring, tracing, session replay, or logging without a framework
  • No framework-specific SDK applies

Note: SDK versions and APIs below reflect @sentry/browser ≥10.0.0. Always verify against docs.sentry.io/platforms/javascript/ before implementing.


Phase 1: Detect

CRITICAL — Check for frameworks first. Framework-specific SDKs provide significantly better coverage and must be recommended before proceeding with @sentry/browser.

Step 1A: Framework Detection (Redirect If Found)
bash
# Check for React
cat package.json 2>/dev/null | grep -E '"react"'

# Check for Next.js
cat package.json 2>/dev/null | grep '"next"'

# Check for Vue
cat package.json 2>/dev/null | grep '"vue"'

# Check for Angular
cat package.json 2>/dev/null | grep '"@angular/core"'

# Check for Svelte / SvelteKit
cat package.json 2>/dev/null | grep -E '"svelte"|"@sveltejs/kit"'

# Check for Remix
cat package.json 2>/dev/null | grep -E '"@remix-run/react"|"@remix-run/node"'

# Check for Nuxt
cat package.json 2>/dev/null | grep '"nuxt"'

# Check for Astro
cat package.json 2>/dev/null | grep '"astro"'

# Check for Ember
cat package.json 2>/dev/null | grep '"ember-source"'

# Check for Node.js server frameworks (wrong SDK entirely)
cat package.json 2>/dev/null | grep -E '"express"|"fastify"|"@nestjs/core"|"koa"'

If a framework is detected, stop and redirect:

Framework detectedRedirect to
nextLoad sentry-nextjs-sdk skill — do not proceed here
react (without Next.js)Load sentry-react-sdk skill — do not proceed here
vueSuggest @sentry/vue — see docs.sentry.io/platforms/javascript/guides/vue/
@angular/coreSuggest @sentry/angular — see docs.sentry.io/platforms/javascript/guides/angular/
@sveltejs/kitLoad sentry-svelte-sdk skill — do not proceed here
svelte (SPA, no kit)Suggest @sentry/svelte — see docs.sentry.io/platforms/javascript/guides/svelte/
@remix-runSuggest @sentry/remix — see docs.sentry.io/platforms/javascript/guides/remix/
nuxtSuggest @sentry/nuxt — see docs.sentry.io/platforms/javascript/guides/nuxt/
astroSuggest @sentry/astro — see docs.sentry.io/platforms/javascript/guides/astro/
ember-sourceSuggest @sentry/ember — see docs.sentry.io/platforms/javascript/guides/ember/
express / fastify / @nestjs/coreThis is a Node.js server — load sentry-node-sdk or sentry-nestjs-sdk skill

Why redirect matters: Framework SDKs add router-aware transactions, error boundaries, component tracking, and often SSR coverage. Using @sentry/browser directly in a React or Next.js app loses all of that.

Only continue with @sentry/browser if no framework is detected.

Step 1B: Installation Method Detection
bash
# Check if there's a package.json at all (bundler environment)
ls package.json 2>/dev/null

# Check package manager
ls package-lock.json yarn.lock pnpm-lock.yaml bun.lockb 2>/dev/null

# Check build tool
ls vite.config.ts vite.config.js webpack.config.js rollup.config.js esbuild.config.js 2>/dev/null
cat package.json 2>/dev/null | grep -E '"vite"|"webpack"|"rollup"|"esbuild"'

# Check for CMS or static site indicators
ls wp-config.php wp-content/ 2>/dev/null   # WordPress
ls _config.yml _config.yaml 2>/dev/null    # Jekyll
ls config.toml 2>/dev/null                 # Hugo
ls .eleventy.js 2>/dev/null                # Eleventy

# Check for existing Sentry
cat package.json 2>/dev/null | grep '"@sentry/'
grep -r "sentry-cdn.com\|js.sentry-cdn.com" . --include="*.html" -l 2>/dev/null | head -3

What to determine:

QuestionImpact
package.json exists + bundler?→ Path A: npm install
WordPress, Shopify, static HTML, no npm?→ Path B: Loader Script
Script tags only, no Loader Script access?→ Path C: CDN bundle
Already has @sentry/browser?Skip install, go straight to feature config
Build tool is Vite / webpack / Rollup / esbuild?Source maps plugin to configure

Phase 2: Recommend

Present a recommendation based on what you found. Lead with a concrete proposal, don't ask open-ended questions.

Recommended (core coverage):

  • ✅ Error Monitoring — always; captures unhandled errors and promise rejections
  • ✅ Tracing — recommended for any interactive site; tracks page load and user interactions
  • ✅ Session Replay — recommended for user-facing apps; records sessions around errors

Optional (enhanced observability):

  • ⚡ User Feedback — capture reports directly from users after errors
  • ⚡ Logging — structured logs via Sentry.logger.*; requires npm or CDN logs bundle (not available via Loader Script)
  • ⚡ Profiling — JS Self-Profiling API; beta, Chromium-only, requires Document-Policy: js-profiling response header

Feature recommendation logic:

FeatureRecommend when...
Error MonitoringAlways — non-negotiable baseline
TracingAlways for interactive pages — page load + navigation spans are high-value
Session ReplayUser-facing app, support flows, or checkout pages
User FeedbackSupport-focused app; want in-app bug reports with screenshots
LoggingStructured log search or log-to-trace correlation needed; npm path only
ProfilingPerformance-critical, Chromium-only app; Document-Policy: js-profiling header required

Installation path recommendation:

ScenarioRecommended path
Project has package.json + bundlerPath A (npm) — full features, source maps, tree-shaking
WordPress, Shopify, Squarespace, static HTMLPath B (Loader Script) — zero build tooling, always up to date
Static HTML without Loader Script accessPath C (CDN bundle) — manual <script> tag

Propose: "I recommend setting up Error Monitoring + Tracing + Session Replay using Path A (npm). Want me to also add Logging or User Feedback?"


Phase 3: Guide

Install
bash
npm install @sentry/browser --save
# or
yarn add @sentry/browser
# or
pnpm add @sentry/browser
Create src/instrument.ts

Sentry must initialize before any other code runs. Put Sentry.init() in a dedicated sidecar file:

typescript
import * as Sentry from "@sentry/browser";

Sentry.init({
  dsn: import.meta.env.VITE_SENTRY_DSN, // Adjust per build tool (see table below)
  environment: import.meta.env.MODE,
  release: import.meta.env.VITE_APP_VERSION, // inject at build time

  dataCollection: {
    // To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:
    // https://docs.sentry.io/platforms/javascript/configuration/options/#dataCollection
    // userInfo: false,
    // httpBodies: [],
  },

  integrations: [
    Sentry.browserTracingIntegration(),
    Sentry.replayIntegration({
      maskAllText: true,
      blockAllMedia: true,
    }),
  ],

  // Tracing
  tracesSampleRate: 1.0, // lower to 0.1–0.2 in production
  tracePropagationTargets: ["localhost", /^https:\/\/yourapi\.io/],

  // Session Replay
  replaysSessionSampleRate: 0.1,
  replaysOnErrorSampleRate: 1.0,

  enableLogs: true,
});

DSN environment variable by build tool:

Build ToolVariable NameAccess in code
ViteVITE_SENTRY_DSNimport.meta.env.VITE_SENTRY_DSN
Custom webpackSENTRY_DSNprocess.env.SENTRY_DSN
esbuildSENTRY_DSNprocess.env.SENTRY_DSN
RollupSENTRY_DSNprocess.env.SENTRY_DSN
Entry Point Setup

Import instrument.ts as the very first import in your entry file:

typescript
// src/main.ts or src/index.ts
import "./instrument";  // ← MUST be first

// ... rest of your app

Without source maps, stack traces show minified code. Set up the build plugin to upload source maps automatically:

No dedicated browser wizard: There is no npx @sentry/wizard -i browser flag. The closest is npx @sentry/wizard@latest -i sourcemaps which configures source map upload only for an already-initialized SDK.

Vite (vite.config.ts):

typescript
import { defineConfig } from "vite";
import { sentryVitePlugin } from "@sentry/vite-plugin";

export default defineConfig({
  build: { sourcemap: "hidden" },
  plugins: [
    // sentryVitePlugin MUST be last
    sentryVitePlugin({
      org: process.env.SENTRY_ORG,
      project: process.env.SENTRY_PROJECT,
      authToken: process.env.SENTRY_AUTH_TOKEN,
    }),
  ],
});

webpack (webpack.config.js):

javascript
const { sentryWebpackPlugin } = require("@sentry/webpack-plugin");

module.exports = {
  devtool: "hidden-source-map",
  plugins: [
    sentryWebpackPlugin({
      org: process.env.SENTRY_ORG,
      project: process.env.SENTRY_PROJECT,
      authToken: process.env.SENTRY_AUTH_TOKEN,
    }),
  ],
};

Rollup (rollup.config.js):

javascript
import { sentryRollupPlugin } from "@sentry/rollup-plugin";

export default {
  output: { sourcemap: "hidden" },
  plugins: [
    sentryRollupPlugin({
      org: process.env.SENTRY_ORG,
      project: process.env.SENTRY_PROJECT,
      authToken: process.env.SENTRY_AUTH_TOKEN,
    }),
  ],
};

esbuild (build.js):

javascript
const { sentryEsbuildPlugin } = require("@sentry/esbuild-plugin");

require("esbuild").build({
  entryPoints: ["src/index.ts"],
  bundle: true,
  sourcemap: "hidden",
  plugins: [
    sentryEsbuildPlugin({
      org: process.env.SENTRY_ORG,
      project: process.env.SENTRY_PROJECT,
      authToken: process.env.SENTRY_AUTH_TOKEN,
    }),
  ],
});

⚠️ esbuild plugin does not fully support splitting: true. Use sentry-cli instead if code splitting is enabled.

Using sentry-cli (any toolchain / CI):

bash
# After your build step:
npx @sentry/cli sourcemaps inject ./dist
npx @sentry/cli sourcemaps upload ./dist

Add .env for auth (never commit):

bash
SENTRY_AUTH_TOKEN=sntrys_...
SENTRY_ORG=my-org-slug
SENTRY_PROJECT=my-project-slug

Path B: Loader Script (WordPress, Static Sites, Shopify, Squarespace)

Best for: Sites without a build system. The Loader Script is a single <script> tag that lazily loads the full SDK, always stays up to date via Sentry's CDN, and buffers errors before the SDK loads.

Get the Loader Script: Sentry UI → Settings → Projects → (your project) → SDK Setup → Loader Script

Copy the generated tag and place it as the first script on every page:

html
<!DOCTYPE html>
<html>
  <head>
    <!-- Configure BEFORE the loader tag -->
    <script>
      window.sentryOnLoad = function () {
        Sentry.init({
          // DSN is already configured in the loader URL
          tracesSampleRate: 1.0,
          replaysSessionSampleRate: 0.1,
          replaysOnErrorSampleRate: 1.0,
        });
      };
    </script>

    <!-- Loader Script FIRST — before all other scripts -->
    <script
      src="https://js.sentry-cdn.com/YOUR_PUBLIC_KEY.min.js"
      crossorigin="anonymous"
    ></script>
  </head>
  ...
</html>

Loader loading modes:

ModeHowWhen SDK loads
Lazy (default)Nothing extraOn first error or manual Sentry call
EagerAdd data-lazy="no" to <script>After all page scripts finish
ManualCall Sentry.forceLoad()Whenever you call it

Safe to call before SDK loads (buffered):

  • Sentry.captureException()
  • Sentry.captureMessage()
  • Sentry.captureEvent()
  • Sentry.addBreadcrumb()
  • Sentry.withScope()

For other methods, use Sentry.onLoad():

html
<script>
  window.Sentry && Sentry.onLoad(function () {
    Sentry.setUser({ id: "123" });
  });
</script>

Set release via global (optional):

html
<script>
  window.SENTRY_RELEASE = { id: "my-app@1.0.0" };
</script>

Loader Script limitations:

  • ❌ No Sentry.logger.* (logging) — npm path only
  • ❌ No framework-specific features (React ErrorBoundary, Vue Router tracking, etc.)
  • ❌ Tracing headers only added to fetch calls made after SDK loads
  • ❌ Version changes take a few minutes to propagate via CDN cache
  • ⚠️ Use defer (not async) on all other scripts when using the loader

CSP requirements:

script-src: https://browser.sentry-cdn.com https://js.sentry-cdn.com
connect-src: *.sentry.io

Path C: CDN Bundles (Manual Script Tags)

Best for: Pages that can't use the Loader Script but need synchronous loading.

Pick the bundle that matches your feature needs and place it before all other scripts:

Errors only (minimal footprint):

html
<script
  src="https://browser.sentry-cdn.com/10.42.0/bundle.min.js"
  integrity="sha384-L/HYBH2QCeLyXhcZ0hPTxWMnyMJburPJyVoBmRk4OoilqrOWq5kU4PNTLFYrCYPr"
  crossorigin="anonymous"
></script>

Errors + Tracing:

html
<script
  src="https://browser.sentry-cdn.com/10.42.0/bundle.tracing.min.js"
  integrity="sha384-DIqcfVcfIewrWiNWfVZcGWExO5v673hkkC5ixJnmAprAfJajpUDEAL35QgkOB5gw"
  crossorigin="anonymous"
></script>

Errors + Session Replay:

html
<script
  src="https://browser.sentry-cdn.com/10.42.0/bundle.replay.min.js"
  integrity="sha384-sbojwIJFpv9duIzsI9FRm87g7pB15s4QwJS1m1xMSOdV1CF3pwgrPPEu38Em7M9+"
  crossorigin="anonymous"
></script>

Errors + Tracing + Replay (recommended full setup):

html
<script
  src="https://browser.sentry-cdn.com/10.42.0/bundle.tracing.replay.min.js"
  integrity="sha384-oo2U4zsTxaHSPXJEnXtaQPeS4Z/qbTqoBL9xFgGxvjJHKQjIrB+VRlu97/iXBtzw"
  crossorigin="anonymous"
></script>

Errors + Tracing + Replay + User Feedback:

html
<script
  src="https://browser.sentry-cdn.com/10.42.0/bundle.tracing.replay.feedback.min.js"
  integrity="sha384-SmHU39Qs9cua0KLtq3A6gis1/cqM1nZ6fnGzlvWAPiwhBDO5SmwFQV65BBpJnB3n"
  crossorigin="anonymous"
></script>

Full bundle (all features):

html
<script
  src="https://browser.sentry-cdn.com/10.42.0/bundle.tracing.replay.feedback.logs.metrics.min.js"
  integrity="sha384-gOjSzRxwpXpy0FlT6lg/AVhagqrsUrOWUO7jm6TJwuZ9YVHtYK0MBA2hW2FGrIGl"
  crossorigin="anonymous"
></script>

CDN bundle variants summary:

BundleFeaturesWhen to use
bundle.min.jsErrors onlyAbsolute minimum footprint
bundle.tracing.min.js+ TracingPerformance monitoring
bundle.replay.min.js+ ReplaySession recording
bundle.tracing.replay.min.js+ Tracing + ReplayFull observability
bundle.tracing.replay.feedback.min.js+ User Feedback+ in-app feedback widget
bundle.logs.metrics.min.js+ Logs + MetricsStructured logs (CDN)
bundle.tracing.replay.feedback.logs.metrics.min.jsEverythingMax coverage

Initialize after the script tag:

html
<script>
  Sentry.init({
    dsn: "https://YOUR_KEY@o0.ingest.sentry.io/YOUR_PROJECT",
    environment: "production",
    release: "my-app@1.0.0",
    integrations: [
      Sentry.browserTracingIntegration(),
      Sentry.replayIntegration({
        maskAllText: true,
        blockAllMedia: true,
      }),
    ],
    tracesSampleRate: 1.0,
    tracePropagationTargets: ["localhost", /^https:\/\/yourapi\.io/],
    replaysSessionSampleRate: 0.1,
    replaysOnErrorSampleRate: 1.0,
  });
</script>

CDN CSP requirements:

script-src: https://browser.sentry-cdn.com https://js.sentry-cdn.com
connect-src: *.sentry.io

For Each Agreed Feature

Walk through features one at a time. Load the reference file, follow its steps, verify before moving on:

FeatureReferenceLoad when...
Error Monitoring${SKILL_ROOT}/references/error-monitoring.mdAlways (baseline)
Tracing${SKILL_ROOT}/references/tracing.mdPage load / API call tracing
Session Replay${SKILL_ROOT}/references/session-replay.mdUser-facing app
Logging${SKILL_ROOT}/references/logging.mdStructured log search; npm or CDN logs bundle (not Loader Script)
Profiling${SKILL_ROOT}/references/profiling.mdPerformance-critical, Chromium-only
User Feedback${SKILL_ROOT}/references/user-feedback.mdCapture user reports after errors

For each feature: Read ${SKILL_ROOT}/references/<feature>.md, follow steps exactly, verify it works.


Configuration Reference

Show full SKILL.md (728 more words)Show less
Key Sentry.init() Options
OptionTypeDefaultNotes
dsnstring—Required. SDK disabled when empty
environmentstring"production"e.g., "staging", "development"
releasestring—e.g., "my-app@1.0.0" or git SHA — links errors to releases
sendDefaultPiibooleanfalseIncludes IP addresses and request headers. Will be deprecated in v11 — use dataCollection instead
dataCollectionobject—Fine-grained control over collected data (v10.54+). See table below
tracesSampleRatenumber—0–1; 1.0 in dev, 0.1–0.2 in prod
tracesSamplerfunction—Per-transaction sampling; overrides rate
tracePropagationTargets(string|RegExp)[]same-originOutgoing URLs that receive distributed tracing headers
replaysSessionSampleRatenumber—Fraction of all sessions recorded
replaysOnErrorSampleRatenumber—Fraction of error sessions recorded
enableLogsbooleanfalseEnable Sentry.logger.* API (npm or CDN logs bundle; not Loader Script)
attachStackTracebooleanfalseStack traces on captureMessage() calls
maxBreadcrumbsnumber100Breadcrumbs stored per event
debugbooleanfalseVerbose SDK output to console
tunnelstring—Proxy URL to bypass ad blockers
ignoreErrors(string|RegExp)[][]Drop errors matching these patterns
denyUrls(string|RegExp)[][]Drop errors from scripts at these URLs
allowUrls(string|RegExp)[][]Only capture errors from these script URLs
spotlightboolean|stringfalseForward events to Spotlight local dev overlay
Browser-Specific Options
OptionTypeDefaultNotes
cdnBaseUrlstring—Base URL for lazy-loading integrations
skipBrowserExtensionCheckbooleanfalseSkip check for browser extension context
dataCollection Option (v10.54+)

Fine-grained control over what data the SDK collects. Replaces the simple sendDefaultPii boolean with granular settings. When omitted, falls back to sendDefaultPii for backwards compatibility.

FieldTypeDefaultNotes
userInfobooleantrueAuto-populate user.* fields from instrumentation
cookiesboolean | { allow: string[] } | { deny: string[] }trueCookie collection; true = all (filtered), false = none, allow/deny = specific keys
httpHeaders{ request?, response? }{ request: true, response: true }HTTP header collection; each can be boolean or allow/deny object
httpBodiesstring[]["incomingRequest", "outgoingRequest", "incomingResponse", "outgoingResponse"]HTTP body types to collect (when dataCollection is explicitly set)
queryParamsboolean | { allow: string[] } | { deny: string[] }trueQuery parameter collection with sensitive value filtering
genAI{ inputs?, outputs? }{ inputs: true, outputs: true }Generative AI input/output recording
stackFrameVariablesbooleantrueCapture local variable values in stack frames
frameContextLinesnumber5Source code context lines around stack frames

Example:

typescript
Sentry.init({
  dsn: "...",
  dataCollection: {
    userInfo: true,
    cookies: { deny: ["session_id", "auth_token"] },
    httpHeaders: {
      request: { deny: ["authorization", "cookie"] },
      response: true,
    },
    queryParams: { allow: ["utm_source", "utm_campaign"] },
  },
});
window.SENTRY_RELEASE Global (CDN / Loader Path)

Set the release version before the SDK loads:

html
<script>
  window.SENTRY_RELEASE = { id: "my-app@1.0.0" };
</script>

Verification

Trigger test events to confirm Sentry is receiving data:

npm / CDN path:

html
<!-- Add temporarily to your page -->
<button onclick="throw new Error('Sentry Browser Test Error')">
  Test Error
</button>

Performance verification (npm path):

javascript
import * as Sentry from "@sentry/browser";

Sentry.startSpan({ name: "Test Span", op: "test" }, () => {
  // your operation
});

Manual capture:

javascript
Sentry.captureException(new Error("Manual test"));
Sentry.captureMessage("Manual test message", "info");

Check the Sentry dashboard:

  • Issues → error appears within seconds
  • Traces → page load transaction visible
  • Replays → session recording visible after page interaction
  • Logs → structured log entries if logging enabled (npm or CDN logs bundle)

Set debug: true in Sentry.init() and check the browser console if nothing appears.


After completing browser setup, check for a companion backend missing Sentry coverage:

bash
ls ../backend ../server ../api ../go ../python 2>/dev/null
cat ../go.mod 2>/dev/null | head -3
cat ../requirements.txt ../pyproject.toml 2>/dev/null | head -3
cat ../Gemfile 2>/dev/null | head -3
cat ../pom.xml 2>/dev/null | grep '<artifactId>' | head -3
cat ../composer.json 2>/dev/null | head -3

If a backend exists without Sentry configured, suggest the matching skill:

Backend detectedSuggest skill
Go (go.mod)sentry-go-sdk
Python (requirements.txt, pyproject.toml)sentry-python-sdk
Ruby (Gemfile)sentry-ruby-sdk
PHP (composer.json)sentry-php-sdk
.NET (*.csproj, *.sln)sentry-dotnet-sdk
Java (pom.xml, build.gradle)See docs.sentry.io/platforms/java/
Node.js (Express, Fastify)sentry-node-sdk
NestJS (@nestjs/core)sentry-nestjs-sdk

Troubleshooting

IssueSolution
Events not appearingSet debug: true, check DSN, open browser console for SDK errors
Source maps not workingBuild in production mode (npm run build); verify SENTRY_AUTH_TOKEN is set
Minified stack tracesSource maps not uploading — check build plugin config; run npx @sentry/wizard@latest -i sourcemaps
CDN bundle not foundCheck version number in URL; see browser.sentry-cdn.com for latest
SRI integrity errorHash mismatch — re-copy the full <script> tag including integrity attribute from this skill
Loader Script not firingVerify it's the first <script> on the page; check for CSP errors in console
Tracing not working with LoaderFetch calls before SDK loads won't be traced — wrap early calls in Sentry.onLoad()
sentryOnLoad not calledMust define window.sentryOnLoad before the loader <script> tag
Logging not availableSentry.logger.* requires npm or a CDN bundle with .logs. in its name — not supported via Loader Script
Profiling not workingVerify Document-Policy: js-profiling header on document responses; Chromium-only
Ad blockers dropping eventsSet tunnel: "/sentry-tunnel" and add a server-side relay endpoint
Session replay not recordingConfirm replayIntegration() is in init; check replaysSessionSampleRate > 0
Replay CSP errorsAdd worker-src 'self' blob: and child-src 'self' blob: to your CSP
tracePropagationTargets not matchingCheck regex escaping; default is same-origin only
Events blocked by browser extensionAdd denyUrls: [/chrome-extension:\/\//] to filter extension errors
High event volumeLower sampleRate (errors) and tracesSampleRate from 1.0 in production
Source maps uploaded after deploySource maps must be uploaded before errors occur — integrate into CI/CD
esbuild splitting conflictsentryEsbuildPlugin doesn't support splitting: true — use sentry-cli instead

© getsentry, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 6 other files (references) in skills-legacy/sentry-browser-sdk of getsentry/sentry-for-ai.

  • SKILL.md
  • references/error-monitoring.md
  • references/logging.md
  • references/profiling.md
  • references/session-replay.md
  • references/tracing.md
  • references/user-feedback.md

Open the folder on GitHubat commit d8fd106

Compare with similar skills

Sentry Browser SDK next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Sentry Browser SDK compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Sentry Browser SDK this skillgetsentry/sentry-for-ai268—~6.5kAutomated safety check: NotesApache-2.0
Migrate Webapi Selectallmicrosoft/power-platform-skills967—~5.3kAutomated safety check: NotesMIT
Tabler Astro Component Scriptstabler/tabler42k—~2.1kAutomated safety check: PassMIT
Kill AI Slopyetone/kill-ai-slop1.3k—~1.4kAutomated safety check: PassApache-2.0
Motion Dev Animations199-biotechnologies/motion-dev-animations-skill1041 repos~2.8kAutomated safety check: NotesMIT
GlideSrivarsanK/Glide125—~1.7kAutomated safety check: PassApache-2.0

Similar skills

  • Migrate Webapi Selectall

    microsoft/power-platform-skills

    Official

    Reviews and migrates deprecated wildcard () values in Power Pages Web API fields site settings to least-privilege explicit Dataverse columns.

    967 GitHub stars~5.3k tokensUpdated today
    Frontend & DesignAuto-check: notes
  • Rules for adding or fixing client-side scripts in Tabler's Astro components so the copied preview HTML stays readable, self-contained and runs in the right order.

    42k GitHub stars~2.1k tokensUpdated today
    Frontend & DesignAuto-check passed
  • Kill AI Slop

    yetone/kill-ai-slop

    Find and remove AI slop — the generic, machine-default visual and copy tics of vibe-coded products — from a web project.

    1.3k GitHub stars~1.4k tokensUpdated 22 days ago
    Frontend & DesignAuto-check passed
  • Motion Dev Animations

    199-biotechnologies/motion-dev-animations-skill

    Creates 120fps GPU-accelerated animations with Motion.dev (Framer Motion successor) for React, Next.js, Svelte, and Astro projects.

    104 GitHub starsUsed in 1 repo~2.8k tokens
    Frontend & DesignAuto-check: notes
  • Glide

    SrivarsanK/Glide

    Authoritative guide and toolset for AI agents to operate, configure, and visually design applications using Glide (@srivarsank/glide).

    125 GitHub stars~1.7k tokensUpdated 6 days ago
    Frontend & DesignAuto-check passed
  • Sanity Best Practices

    robotostudio/turbo-start-sanity

    Sanity development best practices for schema design, GROQ queries, TypeGen, Visual Editing, images, Portable Text, Studio structure, localization, migrations, Sanity Functions, Blueprints, and…

    182 GitHub stars~940 tokensUpdated 2 days ago
    Frontend & DesignAuto-check passed

More from getsentry/sentry-for-ai

All 32 skills in this repo
  • Sentry Elixir SDK

    getsentry/sentry-for-ai

    Official

    Full Sentry SDK setup for Elixir. An agent skill from getsentry/sentry-for-ai.

    268 GitHub stars~3.5k tokensUpdated today
    Auto-check passed
  • Sentry Go SDK

    getsentry/sentry-for-ai

    Official

    Full Sentry SDK setup for Go. An agent skill from getsentry/sentry-for-ai.

    268 GitHub stars~3.2k tokensUpdated today
    Auto-check passed
  • Sentry Nextjs SDK

    getsentry/sentry-for-ai

    Official

    Full Sentry SDK setup for Next.js. An agent skill from getsentry/sentry-for-ai.

    268 GitHub stars~4.7k tokensUpdated today
    Auto-check: notes
  • Sentry Php SDK

    getsentry/sentry-for-ai

    Official

    Full Sentry SDK setup for PHP. An agent skill from getsentry/sentry-for-ai.

    268 GitHub stars~3.7k tokensUpdated today
    Auto-check: notes
  • Sentry Python SDK

    getsentry/sentry-for-ai

    Official

    Full Sentry SDK setup for Python. An agent skill from getsentry/sentry-for-ai.

    268 GitHub stars~4.1k tokensUpdated today
    Auto-check passed
  • Sentry React Router Framework SDK

    getsentry/sentry-for-ai

    Official

    Full Sentry SDK setup for React Router Framework mode. An agent skill from getsentry/sentry-for-ai.

    268 GitHub stars~3.8k tokensUpdated today
    Auto-check: notes

Questions about Sentry Browser SDK

What does Sentry Browser SDK do?

Full Sentry SDK setup for browser JavaScript. An agent skill from getsentry/sentry-for-ai. Sentry Browser SDK is an agent skill from getsentry/sentry-for-ai, published by the product's own GitHub organization. Full Sentry SDK setup for browser JavaScript.

When should I use Sentry Browser SDK?

Sentry Browser SDK fits situations like: asked to add Sentry to a website; install @sentry/browser; configure error monitoring; logging for vanilla JavaScript.

How do I install Sentry Browser SDK in Claude Code?

Run `npx skills add getsentry/sentry-for-ai --skill sentry-browser-sdk -a claude-code`. Or copy the skill folder (skills-legacy/sentry-browser-sdk in getsentry/sentry-for-ai) into .claude/skills/sentry-browser-sdk in your project. Claude Code loads it when a task matches its description.

How do I install Sentry Browser SDK in Codex?

Run `npx skills add getsentry/sentry-for-ai --skill sentry-browser-sdk -a codex`. Or copy the skill folder (skills-legacy/sentry-browser-sdk in getsentry/sentry-for-ai) into .agents/skills/sentry-browser-sdk in your project. Codex loads it when a task matches its description.

Can I use Sentry Browser SDK in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add getsentry/sentry-for-ai --skill sentry-browser-sdk -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/sentry-browser-sdk, .gemini/skills/sentry-browser-sdk, .github/skills/sentry-browser-sdk and .opencode/skills/sentry-browser-sdk in your project.

What does Sentry Browser SDK need to run?

Going by SKILL.md and its folder, Sentry Browser SDK needs the command-line tools its instructions call (npx, npm, yarn and pnpm) and credentials named SENTRY_AUTH_TOKEN. Our summary lists: Node.js; A credential in SENTRY_AUTH_TOKEN.

Does Sentry Browser SDK access the network?

SKILL.md names 4 domains. In commands or code: docs.sentry.io, browser.sentry-cdn.com, js.sentry-cdn.com and o0.ingest.sentry.io; the agent is likely to contact these when it follows the instructions. This is read from the text; nothing was executed.

Is Sentry Browser SDK safe to install?

Our automated static check of SKILL.md found notes only (mentions a .env file), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.

What licence does Sentry Browser SDK use?

Sentry Browser SDK is published under the Apache-2.0 licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Sentry Browser SDK use?

About 6.5k tokens (SKILL.md is roughly 26k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 23k tokens, read only when the agent opens those files.

What are the alternatives to Sentry Browser SDK?

Skills that share tags, products or a category with Sentry Browser SDK: Migrate Webapi Selectall (microsoft/power-platform-skills, 967 stars), Tabler Astro Component Scripts (tabler/tabler, 42k stars), Kill AI Slop (yetone/kill-ai-slop, 1.3k stars) and Motion Dev Animations (199-biotechnologies/motion-dev-animations-skill, 104 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Sentry Browser SDK?

getsentry (a GitHub organization, an official publisher) maintains it in getsentry/sentry-for-ai, which has 268 GitHub stars. The repository holds 32 skills in this directory. The repository was last updated on October 7, 2026.

Source: getsentry/sentry-for-ai on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.