Svelte + SvelteKit is a framework for building web applications of all sizes, with a beautiful development experience and flexible filesystem-based routing.
This guide covers setting up client-side Crash Reporting for an existing SvelteKit (or Svelte) application using the Raygun4JS provider.
Step 1 - Add script
Add the following snippet to the beginning of the
<head> tag within your root
.html file. (E.g.,
Please include this snippet before any other
<script> tag references are made to ensure that Raygun has the best chance to capture all error events on the page.
The above snippet will fetch the Raygun4JS script from our CDN asynchronously, so it doesn't block the page load. It will also catch errors that are thrown while the page is loading, and send them when the script is ready. You can now track and fix any errors once you deploy your app.
Step 2 - Enable Crash Reporting
Add the following lines underneath the previous code in Step 1 with your API key included.
Your Raygun API key (available under "Application Settings" in your Raygun Account).
Optional - Enable Real User Monitoring
If you would like to use Real User Monitoring update the second script to look like this:
Real User Monitoring unlocks real-user insights into front-end performance to quickly identify and resolve issues impacting your end user experience.