Sentry Destination

Destination Info
Connection Modes
Device-mode Cloud-mode
Web Web
Mobile Mobile
Server Server

Sentry is open-source error tracking that helps developers monitor and fix crashes in real time. Iterate continuously. Boost efficiency. Improve user experience. The analytics.js Sentry Destination is open-source. You can browse the code on GitHub.

Getting Started

Before you start, make sure Sentry supports the source type and connection mode you’ve chosen to implement. You can learn more about connection modes here.

Web Mobile Server
📱 Device-mode ⬜️ ⬜️
☁️ Cloud-mode ⬜️ ⬜️ ⬜️
  1. From the Segment web app, click Catalog.
  2. Search for “Sentry” in the Catalog, select it, and choose which of your sources to connect the destination to.
  3. In the destination settings, enter your “Public DSN”.
  4. Segment automatically initializes Sentry with your “Public DSN” upon loading analytics.js.
  5. Sentry will automatically start tracking errors in your app’s JavaScript.


If you’re not familiar with the Segment Specs, take a look to understand what the Identify method does. An example call would look like:


When you call identify we call Sentry.setUser by passing in the traits you provided. We will map the userId you provide as


Segment lets you change these destination settings from the Segment app without having to touch any code.

Setting Description
Public DSN
string. You can find your Public DSN by going to Sentry and clicking Projects & Teams > Any Project > Settings > Client Keys (DSN). This should be the PUBLIC DSN since it does not contain a secret.
Set Release by Property string. Dynamically track the version of your application in Sentry. If the property you set here is on the global window object (example: you input ‘my_custom_version’, and window.my_custom_version = ‘2.4.5’) then we will use that version. If not, we will default to the manually-set Release property. We recommend that this value is unique to prevent it from being overwritten by other integrations.
Debug Mode boolean, defaults to FALSE .

Toggle this setting to “true” to enable Sentry’s debug mode. In debug mode, the Sentry client will log activity to your browser’s console. No events will be sent to your Sentry instance when this setting is enabled.
Environment string. Segment will set the value you enter here as the value of Sentry’s environment configuration option.
Ignore Errors array, defaults to .

A list of error messages to be filtered out before being sent to Sentry. You can add either regular expressions or strings.
Ignore Urls array, defaults to .

The inverse of whitelistUrls and similar to ignoreErrors, but will ignore errors from whole urls matching a regex pattern or an exact string.
Include Paths array, defaults to .

An array of regex patterns to indicate which urls are a part of your app in the stack trace. All other frames will appear collapsed in Sentry’s dashboard to make it easier to discern between frames that happened in your code versus other code. By default, Sentry displays all frames as expanded. Once you add values to this setting, all frames excepts for those you’ve added here will appear as collapsed in Sentry. You can still manually expand all frames from a stack trace in your Sentry dashboard. It would be suggested to add the current page url, and the host for your CDN here.
Logger string. The name of the logger used by Sentry.
Release string. Track the version of your application in Sentry.
Server Name string. Typically this would be the server name, but that doesn’t exist on all platforms. Instead you may use something like the device ID, as it indicates the host which the client is running on.
Whitelist Urls array, defaults to .

The inverse of ignoreUrls. Only report errors from whole urls matching a regex pattern or an exact string. whitelistUrls should match the url of your actual JavaScript files. It should match the url of your site if and only if you are inlining code inside <script> tags. Not setting this value is equivalent to a catch-all and will not filter out any values.

This page was last modified: 15 Jul 2022

Get started with Segment

Segment is the easiest way to integrate your websites & mobile apps data to over 300 analytics and growth tools.
Create free account