06Error tracking

Set up error tracking

Error tracking is one attribute on the snippet you already have. Nothing about a site without it changes: the tracker doesn't fetch or run any of the error code, unless your own code calls sa.reportError().

On Next.js, the SnowAnalytics package sets up browser and server errors, releases and source maps in one install, with nothing on this page to copy.

Turn it on

Add the attribute

Add data-track-errors to the snippet's <script> tag:

<script defer src="https://api.snowanalytics.app/sa.js" data-site="YOUR_SITE_ID" data-track-errors></script>

In SnowAnalytics, open Errors & feedback. The setup page has the snippet with your values filled in, on tabs for Script tag, Next.js, React, Vue and WordPress. Each places the same attribute the way that platform wants. Hand off to AI gives your coding agent a prompt that does it for you.

Choose what else to report

data-track-errors="console" also reports console.error calls. It is off by default because it is noisy on most sites. The setup page has a Report console errors switch that adds it to the snippet.

Tag your releases

Name your build so every issue shows which release brought it:

<script defer src="https://api.snowanalytics.app/sa.js" data-site="YOUR_SITE_ID" data-track-errors data-release="2.14.1"></script>

Or set window.SNOW_RELEASE before the snippet runs. The name can be up to 64 characters. Without either, the release is empty. Releases let SnowAnalytics mark deploys on the chart, resolve an issue in the next release and tell a regression from a new issue. They also match source maps to the build that produced them.

Name a release by its commit, as the SDK does by default, and GitHub shows the pull requests each one shipped.

Ignore errors in the browser

List phrases, separated by commas, and errors whose message contains one, in any case, are never sent:

<script defer src="https://api.snowanalytics.app/sa.js" data-site="YOUR_SITE_ID" data-track-errors data-ignore-errors="Failed to load script, ResizeObserver"></script>

For patterns, set window.SNOW_IGNORE_ERRORS before the snippet runs. It takes strings and regular expressions:

<script>window.SNOW_IGNORE_ERRORS = ["Failed to load script", /^Loading chunk \d+ failed/];</script>

Errors you report yourself are checked against the same rules. To set errors aside from the dashboard, with no change to your site, see Ignore errors like this.

Wait for the first error

The page checks by itself. When the first error arrives, setup steps aside and the overview takes over. Later hides the setup star until you want it back.

After the first error, or after you choose Later, a Set up button in the page header opens the same steps in a panel, with the What lights up list and a Server tab. A small dot on it means something is still unconnected: server errors or readable stack traces.

What it captures

WhatHow it is reported
Uncaught errors and failed promisesThe error's type, message and stack, with the page, browser, device and the visit it broke.
Failed script and stylesheet loadsA LoadError, such as a chunk that didn't download.
Network errors from your own siteRequests to your own domain that fail or answer 5xx, with the method, the path without its query string, the status and how long it took. Request and response bodies are never read.
Broken pagesA page that answers 404 or 5xx counts as an error of its own, the only way to hear about broken links.
Console errorsOnly with data-track-errors="console".
Errors you reportErrors your code catches and sends with sa.reportError(), each with the level you give it.
BreadcrumbsThe last 20 things before an error: page changes, clicks (the element, such as button#pay, and its name: the aria-label, alt or title, or the words of the button or link, up to 60 characters), network calls and console warnings. A click on the page itself isn't recorded.
Web vitalsLCP, INP and CLS, plus TTFB and FCP, sent once as the visitor leaves the page. See Web vitals.

"Your own site" means the page's host, plus any subdomain of the data-domain you set. The tracker's own posts are never counted.

Rage clicks and dead clicks come from the clicks the tracker already collects for heatmaps, so they are not counted twice.

Limits

At most 10 errors are sent from one page view, and the same error is sent once per page view. Capture runs only when tracking is on: a visitor who sends Do Not Track or Global Privacy Control, or who has called sa.optout(), reports nothing.

What is stripped

Before anything leaves the browser, SnowAnalytics removes:

  • query strings from every URL, stack and breadcrumb;
  • email addresses;
  • long digit runs and tokens, such as JWTs and strings of 24 or more letters and digits.

These show as [redacted]. Stack frames keep their file names so source maps can read them.

Server errors

Errors thrown on your server arrive beside the browser's. Send them with a server key, one request per error: the Server tab of the setup panel has the code for Node, Hono and Python.

What the setup page lights up

The What lights up card on the setup page lists what is live and what is next, in setup order:

ItemLive when
Web vitalsThe first page load report arrives.
Rage and dead clicksClicks are being collected for heatmaps.
IssuesThe first error arrives.
Server errorsYour server sends its first error with a server key.
Readable stack tracesSource maps are uploaded.

Already found counts what the data you already collect shows: Rage clicks, Dead clicks, Slow pages and Broken links. They are there before you add the attribute.

Behind a proxy

The error capture is a second script, sa-errors.js, loaded from the same address as sa.js and only on pages with the attribute, or that call sa.reportError(). If you serve the tracker from your own domain, that path needs a route too, or the capture never loads. Errors post through the same events endpoint as page views, so nothing else changes.

A proxied script with no route for sa-errors.js loses errors without any warning. Copy the config from Site settings → Installation → Ad-blocker proof, which includes it.

On this page