+
Set up your SDK
+
+
+ Connect your JavaScript application to Bugsink to start tracking errors.
+ Bugsink is compatible with the
Sentry SDK.
+ Detailed instructions per framework are in the
Sentry SDK Documentation. In the below we provide an overview, zoom in on the differences between Bugsink and Sentry, and provide a snippet with the correct DSN set.
+
+
+
Step 1: Install the SDK
+
+
+ Install the SDK by including a script tag, or by using a package manager such as npm or yarn. Note that the SDK to use depends on your framework (e.g. React, Angular, Vue, etc.).
+
+{% code %}:::text
+npm install @sentry/your-js-flavor --save
+{% endcode %}
+
+
+
Step 2: Initialize the SDK
+
+
+ Initialize and configure the SDK with your DSN. Use the configuration snippet that applies to your framework,
+ and replace the Sentry.init call with the call below:
+
+
+{% code %}:::javascript
+// use the correct import statement for your framework, like:
+
+// import * as Sentry from "@sentry/browser";
+// const Sentry = require("@sentry/node");
+// import * as Sentry from "@sentry/angular";
+
+Sentry.init({
+ dsn: "{{ dsn }}",
+
+ // Alternatively, use `process.env.npm_package_version` for a dynamic release version
+ // if your build tool supports it.
+ release: "my-project-name@...",
+
+ integrations: [],
+ tracesSampleRate: 0,
+{% comment %} sendDefaultPii: true, // not actually implemented yet, see https://github.com/getsentry/sentry-javascript/issues/5347
+{% endcomment %}});
+{% endcode %}
+
+
Step 3: Verify the setup
+
+
+ To verify that everything is working, raise an exception on purpose and check that it appears in Bugsink.
+ A good location for this depends on your framework, but a good place is in the main entry point of your application.
+ (Don't use the devtools console, because it will not be caught by the SDK).
+
+
+{% code %}:::javascript
+// Put something like this in the handler of a button click, on a timeout, or similar.
+throw new Error("Error Thrown on purpose to send it to Bugsink");
+{% endcode %}
+
+
+
+
Further reading
+
+
+
+
+