How to capture errors in website using amplitude.
for amplitude you’ll need to manually pipe errors into events, there’s no magic catcher. devs usually wrap window.onerror, unhandledrejection, and the fetch layer, then fire something like: amplitude.track('frontend_error', { type: 'network', // js | network | auth | validation message: err.message, endpoint: url, page: location.pathname, userId: amplitude.getUserId(), sessionId: amplitude.getSessionId(), }); For form and auth failures, do the same thing: hook your failure callbacks and send an event with context. When you do that, errors show up in funnels and session replay because they're just normal events linked to sessions, not console noise.
window.onerror
unhandledrejection
Hey @Ankit001, what type of errors are you looking to track?
Our Session Replay capabilities allow you to track error analytics and console logs. Is this what you're looking for? You can find out more information here.
Hi Beth, Thanks for responding,
We want to capture user-impacting frontend errors—specifically JavaScript crashes, failed API/network requests, and authentication or form submission failures that block users from accessing or continuing on the site. These errors should be logged as Amplitude events with meaningful context (error type, message, endpoint, page, and user/session ID) so they’re queryable, not just visible in console logs or replays. The goal is to link errors to real user sessions and funnels, allowing us to watch Session Replays and understand exactly where and why users get stuck. If you can give me a clear context about what the developers need to do/ add in the front end code for amplitude to start catching these errors, it will be helpful in setting these up.
Understood, @Ankit001! This isn't available out of the box and is something that will require custom events from your developers.
I don't have specifics on how to setup this specific type of tracking but your developers can use this resource from our Academy to understand the essentials of data management in Amplitude and how to setup event tracking.
Hi , Thanks for the message, this is exactly what I was looking for.
Hi Beth,
Thank you for responding, I have shared this reference to Dev team, hopefully they can get it sorted now. Thank you for your support.
We're losing user journey tracking when anonymous users switch devices during our sign-up flow. Our typical flow: anonymous user visits homepage on desktop → clicks Sign Up → redirects to Auth0 for registration → user verifies email on mobile (creating a new anonymous user ID) → returns to desktop to complete sign-up and…
Clicking ‘Mark all 7 as read’ is not doing anything to clear my alerts MacBook Air 14-inch M4 macOS: 15.5 Browser: Chrome Version 136.0.7103.114
Reality Beyond Dreams is a team of impact producers. At the heart of every film we produce, and every campaign that we design, are the core principles of Social Impact Entertainment. We are dedicated to creating cinematic projects that promote https://realitybeyonddreams.com/
Hi everyone, I’m working on adding Amplitude to a single mobile application serving multiple countries. Inside the app, users are shown a country selector panel (e.g., Egypt, Turkey, UAE, etc.), which determines the localized experience they will receive — each country has its own UX flow and logic. The client wants…
I have installed Amplitude via Google Tag Manager and looks like the user ID is not being set. I have installed 2 tag from GTM. * Tag type as init * Tag type as setUserId Still say Anonymous user