Loader Script

The Loader Script is the easiest way to initialize the Sentry SDK. The Loader Script also automatically keeps your Sentry SDK up to date and offers configuration for different Sentry features.

Using the Loader

To use the loader, go in the Sentry UI to Settings > Projects > (select

projectRepresents your service in Sentry and allows you to scope events to a distinct application.
) > Client Keys (
DSNThe Data Source Name (DSN) key tells the Sentry SDK where to send events, ensuring they go to the right project.
)
, and then press the "Configure" button. Copy the script tag from the "JavaScript Loader" section and include it as the first script on your page. By including it first, you allow it to catch and buffer events from any subsequent scripts, while still ensuring the full SDK doesn't load until after everything else has run.

Copied
<script
  src="https://js.sentry-cdn.com/examplePublicKey.min.js"
  crossorigin="anonymous"
></script>

By default, Performance Monitoring and Session Replay are enabled.

Source Maps

To have correct stack traces for minified asset files when using the Loader Script, you will have to either host your Source Maps publicly or upload them to Sentry.

Loader Configuration

The loader has a few configuration options:

  • What version of the SDK to load
  • Using Performance Monitoring
  • Using Session Replay
  • Showing debug logs

SDK Version

To configure the version, use the dropdown in the "JavaScript Loader" settings, directly beneath the script tag you copied earlier.

JavaScript Loader Settings

Note that because of caching, it can take a few minutes for version changes made here to take effect.

Load Timing

If you only use the Loader for errors, the loader won't load the full SDK until triggered by one of the following:

  • an unhandled error
  • an unhandled promise rejection
  • a call to Sentry.captureException
  • a call to Sentry.captureMessage
  • a call to Sentry.captureEvent

Once one of those occurs, the loader will buffer that event and immediately request the full SDK from our CDN. Any events that occur between that request being made and the completion of SDK initialization will also be buffered, and all buffered events will be sent to Sentry once the SDK is fully initialized.

Alternatively, you can set the loader to request the full SDK earlier: still as part of page load, but after all of the other JavaScript on the page has run. (In other words, in a subsequent event loop.) To do this, include data-lazy="no" in your script tag.

Copied
<script
  src="https://js.sentry-cdn.com/examplePublicKey.min.js"
  crossorigin="anonymous"
  data-lazy="no"
></script>

Finally, if you want to control the timing yourself, you can call Sentry.forceLoad(). You can do this as early as immediately after the loader runs (which has the same effect as setting data-lazy="no") and as late as the first unhandled error, unhandled promise rejection, or call to Sentry.captureMessage or Sentry.captureEvent (which has the same effect as not calling it at all). Note that you can't delay loading past one of the aforementioned triggering events.

If Performance Monitoring and/or Session Replay is enabled, the SDK will immediately fetch and initialize the bundle to make sure it can capture transactions and/or replays once the page loads.

SDK Configuration

You can configure the release by adding the following to your page:

Copied
<script>
  window.SENTRY_RELEASE = {
    id: "...",
  };
</script>

The loader script always includes a call to Sentry.init with a default configuration, including your

DSNThe Data Source Name (DSN) key tells the Sentry SDK where to send events, ensuring they go to the right project.
. If you want to configure your SDK beyond that, you'll need a second script tag, in which you'll call Sentry.onLoad. This script must come after the main loader script.

Copied
<script
  src="https://js.sentry-cdn.com/examplePublicKey.min.js"
  crossorigin="anonymous"
></script>
<script>
  // Check for existence of Sentry in case Ad-blockers block the Sentry Loader Script
  window.Sentry && Sentry.onLoad(function() { ... });
</script>

Sentry.onLoad is a function that only the loader provides, and - as the name suggests - it sets a function to be run once the full SDK has been loaded. In that function, you can configure your SDK exactly the way you would were you using the CDN, with one difference: your Sentry.init call doesn't need to include your DSN, since it's already been set. We recommend checking if Sentry exists before calling Sentry.onLoad in case the loader script failed to load.

Copied
<script>
  // Check for existence of Sentry in case Ad-blockers block the Sentry Loader Script
  window.Sentry && Sentry.onLoad(function() {
    Sentry.init({
      release: " ... ",
      environment: " ... "
    });
    Sentry.configureScope(scope => {
      scope.setTag( ... );
    });
    // etc.
  });
</script>

For Performance Monitoring, by default, the SDK will be initialized with tracesSampleRate: 1. This means that the SDK will capture all traces.

For Session Replay, the defaults are set to replaysSessionSampleRate: 0.1 and replaysOnErrorSampleRate: 1. This means Replays will be captured for 10% of all normal sessions and for all sessions with an error.

Limitations of error-only capturing

When using the Loader Script with just errors, the script injects the SDK asynchronously. This means that only unhandled errors and unhandled promise rejections will be caught and buffered before the SDK is fully loaded. Specifically, capturing breadcrumb data will not be available until the SDK is fully loaded and initialized. To reduce the amount of time these features are unavailable, set data-lazy="no" or call forceLoad() as described above.

If you want to understand the inner workings of the loader itself, you can read the documented source code in all its glory over at the Sentry repository.

CDN

Sentry supports loading the JavaScript SDK from a CDN. Generally we suggest using our Loader instead. If you must use a CDN, see Available Bundles below.

Default Bundle

To use Sentry for error and performance monitoring, you can use the following bundle:

Copied
<script
  src="https://browser.sentry-cdn.com/7.74.1/bundle.tracing.min.js"
  integrity="sha384-1Ez4jfPb8+JxwhUMOcsZ2lSNLTABaKqokJNwn2XQCEgmFuwMewLCLyOKGQbLNYsp"
  crossorigin="anonymous"
></script>

Performance & Replay Bundle

To use Sentry for error and performance monitoring, as well as for Session Replay, you can use the following bundle:

Copied
<script
  src="https://browser.sentry-cdn.com/7.74.1/bundle.tracing.replay.min.js"
  integrity="sha384-sEgetJPXfSlOkEjZ5brVAd3oTlL43T8FO6PVeNUcyjadWeHNlAKI6nWRTqN84RGc"
  crossorigin="anonymous"
></script>

Errors & Replay Bundle

To use Sentry for error monitoring, as well as for Session Replay, but not for performance monitoring, you can use the following bundle:

Copied
<script
  src="https://browser.sentry-cdn.com/7.74.1/bundle.replay.min.js"
  integrity="sha384-/8Nq6STv8CNV2M5cehR8c4U9hUfPWkl443MyxotaXBlJQhtU9Ty3gHVfyNSF1kgP"
  crossorigin="anonymous"
></script>

Errors-only Bundle

If you only use Sentry for error monitoring, and don't need performance

tracingThe process of logging the events that took place during a request, often across multiple services.
or replay functionality, you can use the following bundle:

Copied
<script
  src="https://browser.sentry-cdn.com/7.74.1/bundle.min.js"
  integrity="sha384-wZKsodWOq2xjiliM4L1aSuNEkx/sTKy6cbcw+gi/8u7nHKwK2ZyODMb3Uk/aU9jh"
  crossorigin="anonymous"
></script>

Usage & Configuration

Once you've included the Sentry SDK bundle in your page, you can use Sentry in your own bundle:

Copied
Sentry.init({
  dsn: "https://examplePublicKey@o0.ingest.sentry.io/0",
  // this assumes your build process replaces `process.env.npm_package_version` with a value
  release: "my-project-name@" + process.env.npm_package_version,
  integrations: [
    // If you use a bundle with performance monitoring enabled, add the BrowserTracing integration
    new Sentry.BrowserTracing(),
    // If you use a bundle with session replay enabled, add the SessionReplay integration
    new Sentry.Replay(),
  ],

  // We recommend adjusting this value in production, or using tracesSampler
  // for finer control
  tracesSampleRate: 1.0,

  // Set `tracePropagationTargets` to control for which URLs distributed tracing should be enabled
  tracePropagationTargets: ["localhost", /^https:\/\/yourserver\.io\/api/],
});

Available Bundles

Our CDN hosts a variety of bundles:

  • @sentry/browser with error monitoring only (named bundle.<modifiers>.js)
  • @sentry/browser with error and performance monitoring (named bundle.tracing.<modifiers>.js)
  • @sentry/browser with error and session replay (named bundle.replay.<modifiers>.js)
  • @sentry/browser with error, performance monitoring and session replay (named bundle.tracing.replay.<modifiers>.js)
  • each of the integrations in @sentry/integrations (named <integration-name>.<modifiers>.js)

Each bundle is offered in both ES6 and ES5 versions. Since v7 of the SDK, the bundles are ES6 by default. To use the ES5 bundle, add the .es5 modifier.

Each version has three bundle varieties:

  • minified (.min)
  • unminified (no .min), includes debug logging
  • minified with debug logging (.debug.min)

Bundles that include debug logging output more detailed log messages, which can be helpful for debugging problems. Make sure to enable debug to see debug messages in the console. Unminified and debug logging bundles have a greater bundle size than minified ones.

For example:

  • bundle.js is @sentry/browser, compiled to ES6 but not minified, with debug logging included (as it is for all unminified bundles)
  • rewriteframes.es5.min.js is the RewriteFrames integration, compiled to ES5 and minified, with no debug logging
  • bundle.tracing.es5.debug.min.js is @sentry/browser with performance monitoring enabled, compiled to ES5 and minified, with debug logging included
FileIntegrity Checksum
bundle.debug.min.jssha384-XV0YX17fOVKhTB2rP6RO+Sb3264xtE7Pu1sKCqs7DuiE1Ha4wRp2AfDzJGbza2Go
bundle.es5.debug.min.jssha384-/0apm2/VP05W8UkHmmx5ePS0p9dd2bbHacadqQWk/wYOI9PriwQqX0HaQKf9VaC3
bundle.es5.jssha384-qdHxSFKbrE1PfSYE3m9V6EaFnxCeurhd9Xi54okt7u0OiBg+DuCZ9v4ncmimZkhS
bundle.es5.min.jssha384-oBvhin0NSFm/XP1Qrkx+Ry7RBUAIQgkhmO778oNvuFMsxl+PLyHGeMZu14j1wNcm
bundle.jssha384-D87P766/dv3JmVtTzHDIc6ybGX0jFXelwRFrV41U+jJi9wSJPE5D5ezPmHumYLLs
bundle.min.jssha384-wZKsodWOq2xjiliM4L1aSuNEkx/sTKy6cbcw+gi/8u7nHKwK2ZyODMb3Uk/aU9jh
bundle.replay.debug.min.jssha384-f6ZeAvCLKEeb0Iu/FKTfFDwDGd/hoDIy6PQ77Pj+LivbCtlCD+It1rS9e/liIG3w
bundle.replay.jssha384-zQjZtIgmFTyPWcprq6QiELUuvC7JW5sRetBQpGma+fs+jmq9rG5zKZVec/xlJ9yh
bundle.replay.min.jssha384-/8Nq6STv8CNV2M5cehR8c4U9hUfPWkl443MyxotaXBlJQhtU9Ty3gHVfyNSF1kgP
bundle.tracing.debug.min.jssha384-PEgQTyBYt40kKbss+BW8KC0LWhwiepgRvRht3THP3bIoUP0sv7C9NSFao3kEcRDm
bundle.tracing.es5.debug.min.jssha384-CTECeo/MVlTg9B3glOKxQM8C+BTVUff5MZlcd0ya5AoPPtxaM/cuL4cGjN1fCBnx
bundle.tracing.es5.jssha384-rYWLnIbR9SgIX1YoplRKhvU+gXXsKLNDa1MCUS9OIyTgsZyfhrTyYZLkIlEC9Cc6
bundle.tracing.es5.min.jssha384-zel0Jr47CThm8KmDSH6u8eUiBO9MMSQqVqps62FSfUUa3IbkoNlIMx1EKZAXWzWm
bundle.tracing.jssha384-U8KHmH9Sfe16d+jpWC8wRTjyYt69K2Cv8in3ZdqQCtpLl216iRQgIkdXLuuy35Pb
bundle.tracing.min.jssha384-1Ez4jfPb8+JxwhUMOcsZ2lSNLTABaKqokJNwn2XQCEgmFuwMewLCLyOKGQbLNYsp
bundle.tracing.replay.debug.min.jssha384-MfUWQU04aZucoKPRn9BH6Apn+5mGogM6Y1y6Cza71CcTWYFODYmQ3ieBn4xTR4J8
bundle.tracing.replay.jssha384-nQEG60RHlyYcyMeXAZjhNrZDsLTnUlxyxClvje2MmmS7ggM2TlmtRG6hmE4BfoLx
bundle.tracing.replay.min.jssha384-sEgetJPXfSlOkEjZ5brVAd3oTlL43T8FO6PVeNUcyjadWeHNlAKI6nWRTqN84RGc
captureconsole.debug.min.jssha384-sh3ESAQju/a17hDjCbYoSE75AQUBb9DRHfZ1p2D44wF+Rn/q4nniqaZFxdLqkTr0
captureconsole.es5.debug.min.jssha384-LP0SsHOAl7OQuKhyPYmP2Cr4m2I6riZ3ycLFe/gRfUHDK18yvJ8GDykVawqFfS+W
captureconsole.es5.jssha384-koevfi/8P4EeoBUAffrGAfcZ5sW72b0doLbpd8td+qIW/RvwXDGSzRfPF+/raBuQ
captureconsole.es5.min.jssha384-kFP+W8+9oOP+DAiIJLWCrj87RDoXB61HMXrvJxIMd6Fuyv0KekhjNlf+Y3z5D2oZ
captureconsole.jssha384-37Yuy9uOp6xBTC27clE6euoWYMlxjcGndDJIJ4uVLjnNPUbeHEGSs1doyQcZMUIJ
captureconsole.min.jssha384-xlpjp4hCO09USF7MXbOIYu13P5ojYVCn2y0OLOvYDOKWvUwEwxJfMh67XiiIBOBI
contextlines.debug.min.jssha384-b4QHxskVEO1MUYgjcQ7Z9btXkPjB10vW5N6gsLi3BYMqPOUV+kI+TJBHotelchGF
contextlines.es5.debug.min.jssha384-kO9ZBMMjKJdZH8Xt11YYVpUWiegCPIokvFzEvQk9+JuGg6XaF8TERLDpFUvt+uNh
contextlines.es5.jssha384-EcLVByY0Jkm8Q/rBH1m3UO6jzPGeoUSuweGTEMd6u2F+8BeY//zUWZD5r9gXNDmt
contextlines.es5.min.jssha384-GktWgVIkYWb17EjfNx2cWqEO1lJhG9JrRWswFdLsjGwyTZaXWJLebuXBpRWaSbgz
contextlines.jssha384-HWZD6i7gNXTzoy7sKzfO9P8OPmE3nwH9B8gP1OWfnXRfye1TBTglSjSyMQYEW4P3
contextlines.min.jssha384-u2D+8Xd/dEek235EjDJIxP7ob0YdavgxH6/p0bRmzNA9bvBLgBaQObYNKLXVztbz
debug.debug.min.jssha384-iFVppb/h0iEnQBHKdWIW3kwi55g2fYWW3TKC0wIf0M6mLF+VRzqoWfZAhm9I/LeT
debug.es5.debug.min.jssha384-tembamdjcu89OFLiu84lCO1GeovP9Bi/XFiK3LyM8t0cPF847dJLea/qAZEefjMR
debug.es5.jssha384-lT2YwmZStbeymVYoM7IYaJcS3FX2iBoGJ1mOo9nuvGjJrTr/k9zGvRi0pSxljHtg
debug.es5.min.jssha384-SdqWg8MOgz/J1h6GY77tqDlRFKwA9LktolzYIZs2dY4wJ5jv0339GLKt6JSRNX8e
debug.jssha384-Aw+Tnw1DgXf3W6VldhByR6nbD6EpunLlHJ52h95oVjSl8U2RifzB0VQzn9iM3o8F
debug.min.jssha384-2gnh+joMMurTfyGCVi8e4GbcHe6qAN90nsknK/iNXYocovFhXpCq/0nbmWoWXOs5
dedupe.debug.min.jssha384-kFWVc8QbH2na2fEezukMRXbmSYoXJTiGyE9ZXGdfFa2SkmVZHCe9YoJxwSD58iof
dedupe.es5.debug.min.jssha384-dUjTOOQlsC48Dgab6+0wrp0BzVR/OMmqED9aZ2xqc1FhdfAaT50vl25tU3unfVN3
dedupe.es5.jssha384-kB3XHrwQj78zSRdot1fB48kwOXk7nviU1RVrvGMmfCgad6tKt9mrpacP4YuBG4TA
dedupe.es5.min.jssha384-j2oxo5Ivh5vYixILpRhLsorbJ7NUGgEt+c9X1bSGJwEG9AFOjxuCTyOd+gS0A81o
dedupe.jssha384-Fnfv4jyudu90YXiGbicDpTWrUFv8RDpim/ieCSF8cnQaOqOx0nfkhUX2rprQkhIj
dedupe.min.jssha384-ZkVubh01K+2jugbhpsvG/qktswdFsu2fNMMV/Q51W1nobXFkieIjeLjtbYGuyMdH
extraerrordata.debug.min.jssha384-RviEkJPdtunzHlo/O69N/84x9PBo6oXgs5exErTwjcc2AVrd+RfjybtofiRyR+G9
extraerrordata.es5.debug.min.jssha384-vyxQb1pSRBHxc0RSbYrLxM+y1Q6Gzkn2gX8o5s6vXGEKGLoiemQucE/bCTWNvEea
extraerrordata.es5.jssha384-7FMNW0rrFsnJDfjYq9ZPc5AUZwmEW2A0mgVzRegig8wEGvP9mtp+RisVW5o9dNLB
extraerrordata.es5.min.jssha384-rzQMCC23MjB3WydK+nGbXu7BJfuYmEszDuzYvpterwFHeXaZ2FhznnUfrpXlpVla
extraerrordata.jssha384-52eOdcuhJgvG+a9dElvX3BmNVMJj/AhaC5VmFV6BDdb55Jt8+Ic0I0FGoEKtjYf1
extraerrordata.min.jssha384-CJcoblk74CaYP7y4gQiZj4LZ53nicPpSQAU//oFx0nY4feqSx0ZPRB2q5BeCdL1K
httpclient.debug.min.jssha384-4QE32XQncYFXjqf5AsdGeUp4TbopmeyCTbP96Xx6QX2oSBDOa3taR6ug0Hs2znHW
httpclient.es5.debug.min.jssha384-V+pTR6eq30UpSopsqXcN8+Q4T4melD3F17eRlfoXSA3Uca8Vcf57B1xyh1kv3i0B
httpclient.es5.jssha384-zlf2AS+ao258fQQ/BA6VptCFzAIGtGOOaNeP9TYr5Faovjq7ceFLCNsBDeRTlShC
httpclient.es5.min.jssha384-J6foQLqE85oM9x1BiUbpkfNtQ7zSJkCnnRqdmIYvUSWnohrdIJT9dr+VkH+l4EoO
httpclient.jssha384-CpuXZevzREkHrdbDYuh0N5d8ddIX0b6O2JNWt94kpQHpHiWI/I8JjGyl9fFORZ7L
httpclient.min.jssha384-GKaAVffAUhfU+lNv3IPBK2BGOTossQ4ej29OjrSzm4m9pgOKCH5XAZCWGYdn1QQI
offline.debug.min.jssha384-jubHQ/3lVFKlrz9wIwA3kHsBIVLMc2Gt0s0bN2Ad8SrK1WkmEj7mkez7ZVgFLxkJ
offline.es5.debug.min.jssha384-m3Fxcz7GEhNkDROVZD8aAkMDMpvvP9nejk8Go0+zx2UuoPcjyBuHztLMevTlpWso
offline.es5.jssha384-7p5DPXnuedYuR1+J2RXJcNL0AbBhEBvIlrMDl/2P63QgKu62zBs4VHtzfJX0h4CB
offline.es5.min.jssha384-D6cHgrwsLlvrgf6t9h4K+ZeXLUFV9hoOTPAYyuSz7+c6VhTAO/J5pw2I4kmhrIBg
offline.jssha384-d1ycKAjEYKsF53rn2Zx3AQsHnklT2QRK0UHrjYEHY0vOCKJazUmxto7QlFZTjoXd
offline.min.jssha384-4KTq745iV3/Eesu4X2bVix/8ZH9P3eL92zwtsNVMZCe0YxkcSlyo7jDSsd0Tlh2R
replay.debug.min.jssha384-mnN8jPq/hcEvuObu7rcmBAEYpdHfxluOIU6w1oBfk0WSVXag6NnzDnK1qw+P+8XG
replay.jssha384-a7sot8vMVZGE7yE5tUrOLdIDg7Sg3/xvOisfw6UWjXgb9cSrWths5KIzdIStE1fu
replay.min.jssha384-aSlShgxtblamD5LjJXxjJFRWxKHOZe2X92aOXto6huuK65IBrKvi+uhth/3WQgWE
reportingobserver.debug.min.jssha384-FRuv+oOIObCxERVUWIJsqzY9p+ry0cBmPFXr1Q4dKGc5yVmfhb4lGHBzkmP1NWuv
reportingobserver.es5.debug.min.jssha384-VUJR53t/JOpzfPCyWRRLl6dNg2bTm5QXKyoHP+xpBDy2RdBOmCZgRhaJ1Uhr2NfN
reportingobserver.es5.jssha384-ZPO6p/KI6XErpAnC1T+oaJG61gWr2YEskzzRlDu5NwYb6xmsC7cizKluvygB3p/Q
reportingobserver.es5.min.jssha384-8Os7H0Os3wSgAZjvUYdZfKuOdQ1HjYS6fa0xWs2E+9by3gydm7mgO65x89HtxlB7
reportingobserver.jssha384-NSBd6X07f6BBozFlf1hayle8dzLaTEadPH+g38HNosZadM78ARi+k8lCVqpvVUw+
reportingobserver.min.jssha384-L9sggxu7EXbbk1yoxOysvvYBthFgat4WuYrelYxfY/1+6h7e2DLZipxgxN/N8PYc
rewriteframes.debug.min.jssha384-NAlbDKwPnaXQFG3A+tyTFhlLoR7BctyCD4JqHFzZz7cgPn3whCulTVfcfDOa8sI5
rewriteframes.es5.debug.min.jssha384-K3BPItzIFtWq7zKY+eoTMf1GY10XPkGTvX7gA7PsNpVgtIi4ha/n/i+oBo4Njkq6
rewriteframes.es5.jssha384-M6bDcIET+W88NfX8/tN/WRgwOlVhvnMW07X6c4nL/hRsCBDmlKMmw1mLjnlo54+o
rewriteframes.es5.min.jssha384-70Yj9DDk5mnt9H8FNwn8LaMuFtDnipbGjyz+UNJneaIxJ6hidAlk1Vr56lg4g5QI
rewriteframes.jssha384-AUfDgafnKZeAQ88S4O8NSNMNDlh78HE33eEaUZodovoel6MeQAO+vffA8IESbeuZ
rewriteframes.min.jssha384-+HMEdBgr57kYNneyZZX0C3O/AHLqPXGpsOa6svlJLi8QOaPUdAP5Z38lACkx4g4q
sessiontiming.debug.min.jssha384-+PH0vNV1amWqOMtRuKdMXp6+J/1lYn0UO+GIbS0tTUwOKPQ/L8ezPZJNkQ2A6rXs
sessiontiming.es5.debug.min.jssha384-6nWob37kEJ98cLCUHoqddwaCJpN1+1ioXIRvAsrSUjOTgzZo1cwYSHuT8VUJDvMl
sessiontiming.es5.jssha384-zVOhvReZhzhCPNWegJy6j74tggknp6vqqv8GAhmbpZFM/2IWlxhtZKFAYcwS58j+
sessiontiming.es5.min.jssha384-RmvdZ1k+VAGPR7r4ynyyfiYphXlB3jk6afoQ78Ril8vK+fsyovXqFfQy6BLvyORu
sessiontiming.jssha384-QRoHtktSs4dFJdV1GtkkV02fFQAlSqS4Xx4uyO8jzkwZsHC+DlNAxkg8QCuKXZgi
sessiontiming.min.jssha384-fSaxy+5qk5jQ6kjgXp6ddDdqP1aMM0hu6/gmr+ofznerMXjwoRBaYhghNV9NLq8j
transaction.debug.min.jssha384-oy4ihNhotg1/bTzYP9IWs4NinEas1XW6eH/ZYjjfspYAeUGwiCUNCU2liXo6ZcCc
transaction.es5.debug.min.jssha384-h74v2POV/MyqDJgomBP1HOr4TT2q0wNtp7TbjkKj3Csy5EZX4zAx9wTforFfxoGX
transaction.es5.jssha384-1L/rDf4odaQLGEsjAN+XOTx/GouCJzM0EEo6kKgc0mGlJYLnEPzTU+I60NMfrYX6
transaction.es5.min.jssha384-PLykw49WtjrXqelPTCQtrakdLfh9hB+LBRvhHzwP7vBO8swdRpjwrrSDuaoxgYUQ
transaction.jssha384-pfUG4elY00+M66psmS+4I6thbRA1b/dScpAFkY8y/BboNWrFnhpYzCb+8HVtS0IU
transaction.min.jssha384-MODPv0MZFHWf36UPfxz8o9TWKXTKvJMzMdNvy72AB6Qj3YEEOfzM+R0Cap3ORibe

Additional Configuration

Using defer

If you use the defer script attribute, we strongly recommend that you place the script tag for the browser SDK first and mark all of your other scripts with defer (but not async). This will guarantee that that the Sentry SDK is executed before any of the others.

Without doing this you will find that it's possible for errors to occur before Sentry is loaded, which means you'll be flying blind to those issues.

Content Security Policy

If you have a Content Security Policy (CSP) set up on your site, you will need to add the script-src of wherever you're loading the SDK from, and the origin of your

DSNThe Data Source Name (DSN) key tells the Sentry SDK where to send events, ensuring they go to the right project.
. For example:

  • script-src: https://browser.sentry-cdn.com https://js.sentry-cdn.com
  • connect-src: *.sentry.io
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) to suggesting an update ("yeah, this would be better").