React js implementation
installation in your project
Add the Sentry SDK as a dependency using npm or yarn
npm install --save @sentry/reactin your index.js
const isLocalhost = () => {
return (
window.location.hostname === 'localhost' ||
window.location.hostname === '127.0.0.1'
);
};
if (!isLocalhost()) {
Sentry.init({
dsn: 'https://[email protected]/4505526450782208',
integrations: [new Sentry.BrowserTracing(), new Sentry.Replay(),],
// Performance Monitoring
tracesSampleRate: 1.0, // Capture 100% of the transactions, reduce in production!
// Session Replay
replaysSessionSampleRate: 0.1, // This sets the sample rate at 10%. You may want to change it to 100% while in development and then sample at a lower rate in production.
replaysOnErrorSampleRate: 1.0, // If you're not already sampling the entire session, change the sample rate to 100% when sampling sessions where errors occur.
tracePropagationTargets: ['localhost', /^https:\/\/yourserver\.io\/api/,],
},);
}Last updated