How to use the @sentry/browser.setUser function in @sentry/browser

To help you get started, we’ve selected a few @sentry/browser examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github getsentry / sentry / src / sentry / static / sentry / app / bootstrap.jsx View on Github external
Sentry.init({
  ...window.__SENTRY__OPTIONS,
  integrations: [
    new ExtraErrorData({
      // 6 is arbitrary, seems like a nice number
      depth: 6,
    }),
    new Integrations.Tracing({
      tracingOrigins: ['localhost', 'sentry.io', /^\//],
      tracesSampleRate,
    }),
  ],
});

if (window.__SENTRY__USER) {
  Sentry.setUser(window.__SENTRY__USER);
}
if (window.__SENTRY__VERSION) {
  Sentry.setTag('sentry_version', window.__SENTRY__VERSION);
}

// Used for operational metrics to determine that the application js
// bundle was loaded by browser.
metric.mark('sentry-app-init');

// setup jquery for CSRF tokens
jQuery.ajaxSetup({
  //jQuery won't allow using the ajaxCsrfSetup function directly
  beforeSend: ajaxCsrfSetup,
});

const render = Component => {
github hypothesis / client / src / sidebar / util / sentry.js View on Github external
function setUserInfo(user) {
  Sentry.setUser(user);
}
github mcuking / mobile-web-best-practice / src / utils / report.ts View on Github external
public setUser(userInfo: UserInfo) {
    Sentry.setUser(userInfo);
  }
github universitas / universitas.no / webpack / src / common / sagas / authSaga.js View on Github external
const setUserContext = ({ pk, email, contributor_name }) => {
  const user = { id: pk, name: contributor_name, email }
  if (process.env.NODE_ENV == 'production') Sentry.setUser(user)
}