diff --git a/src/containers/error-boundary.jsx b/src/containers/error-boundary.jsx index e5bfb3ea2447de5b0940767de3b29c17ccd6de56..cc34b87dd398abf0a4f830672251685874584a6c 100644 --- a/src/containers/error-boundary.jsx +++ b/src/containers/error-boundary.jsx @@ -27,7 +27,7 @@ class ErrorBoundary extends React.Component { // Display fallback UI this.setState({ hasError: true, - errorId: window.Raven ? window.Raven.lastEventId() : null + errorId: window.Sentry ? window.Sentry.lastEventId() : null }); // Log errors to analytics, separating supported browsers from unsupported. @@ -37,8 +37,13 @@ class ErrorBoundary extends React.Component { action: this.props.action, label: error.message }); - if (window.Raven) { - window.Raven.captureException(error, {extra: info}); + if (window.Sentry) { + window.Sentry.withScope(scope => { + Object.keys(info).forEach(key => { + scope.setExtra(key, info[key]); + }); + window.Sentry.captureException(error); + }); } } else { analytics.event({ diff --git a/src/lib/analytics.js b/src/lib/analytics.js index 7b3098d6ba677e2b4efb0cc1494e474a1dc9e411..a411ed9582f3d895d2fd703fa8ac5fcdc5f22a46 100644 --- a/src/lib/analytics.js +++ b/src/lib/analytics.js @@ -1,6 +1,6 @@ import GoogleAnalytics from 'react-ga'; -GoogleAnalytics.initialize(process.env.GA_ID, { +GoogleAnalytics.initialize(process.env.GA_ID || window.GA_ID, { debug: (process.env.NODE_ENV !== 'production'), titleCase: true, sampleRate: (process.env.NODE_ENV === 'production') ? 100 : 0,