JavaScript error tracking is included with the Pro and Pro+SPA browser agent. Read the docs
Checking for browser agent…
New Relic browser monitoring

Break things.
On purpose.

Throw real JavaScript errors, report the ones you catch, decide which ones matter, then find every one of yours in a shared New Relic account.

Errors and logs are different event types. Uncaught errors and noticeError() create JavaScriptError events. console.error creates an ERROR Log. This page shows both.
// 1. Uncaught errors are captured automatically
cart.total.toFixed(2) // TypeError

// 2. Report errors you catch and handle
try { applyCoupon(code) }
catch (err) {
  newrelic.noticeError(err, { coupon: code })
}

// 3. Drop the noise, group what matters
newrelic.setErrorHandler(err =>
  /ResizeObserver/.test(err.message)
    ? true : { group: 'Checkout' })
Your data is tagged as … NR-XXXX Change

Everyone shares one New Relic account, so we tag your errors. Your name and code are attached as demoUser and demoCode. The error messages stay the same for everyone, so identical errors group together. Your name is also set as your end-user ID via newrelic.setUserId(), which is what powers the Users affected count in Errors Inbox.

Write this code down. You will search for NR-XXXX in the queries further down. It stays the same on every page until you click New code or close this tab.

Try it / Generate errors

Break something

These are real errors. Your browser console will show red text, and that is the point. The page keeps working, and the feed on the right shows what New Relic receives.

addRelease() stamps this version on every error you send, so you can compare releases in Errors Inbox.

Method 1 · Automatic

Uncaught errors and promise rejections

No code needed. The agent listens for anything your app fails to catch. Each button causes a genuine error of that type, so the error class and stack trace are real.

Method 2 · Handled errors

newrelic.noticeError()

Your code caught the error and recovered, but you still want to know. The user sees nothing.


            
Method 3 · Filter and group

newrelic.setErrorHandler()

One handler sees every error before it is sent. Return true to drop it, or { group } to label it in Errors Inbox. Edit the rules, then throw an error that matches.

Errors vs. error logs

One failure, two signals

An error tells you what broke with a stack trace, grouped in Errors Inbox. An ERROR log tells you what was happening in your own words. Send both, linked by a shared errorId, and you can jump from one to the other. Compare it with the Logs demo.

Real-world scenarios

What your users actually hit

Each scenario plays out a short story using a mix of the methods above. Watch how the error handler rules change the outcome.

Find it / Search the shared account

Find your errors

Errors are sent in batches, so allow up to a minute. Everything below is already filled in with your code, NR-XXXX.

Your JavaScript errors

  1. Open the query builder in New Relic.
  2. Run this to see each error with its class and release.

          
Open New Relic

Your ERROR logs

  1. Same query builder, different event type.
  2. Match errorId values to errors from the "Both" button.

          

See them in Errors Inbox and Session Replay

  1. Go to Browser, open the demo app, then select Errors (errors inbox).
  2. Everyone who throws the same error lands in the same group, which is what makes Users affected climb. Errors you grouped show up under your custom label, such as Payment failures.
  3. Open an error group and search its profile for demoCode = NR-XXXX to find your own occurrences.
  4. Open an error and look for its session replay. This app records replays for sessions that hit an error, so you can watch the clicks that led to it. Text is masked in replays for privacy.
An error is missing?Check your error handler rules. Ignored errors never leave the browser, which is exactly what makes ignoring noise cheap.
Seeing errors you didn't throw?Errors from browser extensions and third-party scripts show up too. That is what setErrorHandler() is for.