NPM

In order to get started using the Sentry JavaScript SDK, add the following code to the top of your application, before all other scripts:

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

The Loader Script allows you to configure some SDK features from the Sentry UI, without having to redeploy your application. The Loader Script documentation shows more information about how to use it.

Alternatively, you can also install the SDK via a package manager:

Copied
npm install --save @sentry/browser

If you're updating your Sentry SDK to the latest version, check out our migration guide to learn more about breaking changes.

If you are using our previous Browser Javascript SDK, you can access the legacy SDK documentation, until further notice.

Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").