# Errors

The JavaScript errors visitors run into, grouped by cause, with the stack, the pages they break and the browsers.

The Errors page shows the JavaScript errors visitors run into on your site. It groups the reports by cause and shows each group's stack, the pages it breaks and the browsers it breaks in. An error that a release brings in shows up the same day. Errors come with Insight and Foresight.

## Turn it on

Add `data-errors` to the snippet.

```html
<script defer src="https://cdn.ultanimus.com/s.js" data-site="YOUR_SITE_ID" data-errors></script>
```

With the [Next.js](/docs/install/nextjs) or [React](/docs/install/react) package, pass the `errors` prop.

```tsx
<Analytics site="YOUR_SITE_ID" errors />
```

The script then reports the errors your code does not catch. The code that sends them is a separate file of 620 bytes gzipped, and only a page that throws downloads it.

Put the snippet above your own scripts in the `<head>`, and it catches errors from the first line your code runs, hydration included. The Next.js and React components add the script after the page hydrates, so they miss errors thrown before that.

Within 5 minutes of a page view with `data-errors` on, the Errors page shows Watching for errors until the first error arrives. If it still asks you to add `data-errors`, no such page view came in during the last 7 days.

## What counts

An error counts when it reaches the window: an exception nothing caught, or a rejected promise with no handler. Errors you catch in your own code do not count, and neither do console messages.

A page view reports at most 10 errors, and the same error once. Each visitor reports at most 10 errors per page per day. Errors thrown inside browser extensions do not count, and neither does the browser's ResizeObserver loop notice, which breaks nothing on the page.

## How errors are grouped

Reports with the same type, the same message and the same place in your code form one group. The place is the first frame of the stack in a file from your own domain, or the first frame when none is. Two things keep a group together across releases:

- File names keep only the part before the first dot, dash or underscore, so `app-4f1c.js` and `app-9d2e.js` are the same file. Line and column numbers are left out, and so are one- and two-letter function names.
- Numbers in the message count as one number, so `Loading chunk 4021 failed.` and `Loading chunk 77 failed.` are one group.

## The page

- **Errors.** Every error in the range, with an arrow against the period before. An arrow up is red.
- **Visitors hit.** The visitors who ran into at least one error.
- **Views hit.** The share of page views that had at least one error.
- **Error groups.** How many groups had an error in the range.
- **Errors by day.** The count of each day, with your [annotations](/docs/tracking/annotations) marked, so a jump lines up with the release that caused it.
- **New in this range.** Groups that first appeared in the range, looking back over the 90 days kept. With 90 days picked, everything kept is in the range, so the list is hidden.
- **Error groups.** The 30 busiest groups. Open one to see the stack of its newest report, the 5 pages and browsers with the most errors, and when it was first and last seen.

The range in the header picks 7, 30 or 90 days. Error reports are kept for 90 days.

## One page

Open a page inside a group to narrow the whole page to the errors on that page. A chip in the header names the page, and its cross goes back to every page. The filter lives in the address as `?page=/checkout`. A path matches exactly, without its query string.

## Script error.

A browser hides an error thrown by a script from another domain. It reports only `Script error.`, with no stack. To see the message and stack of your own scripts on a CDN, add `crossorigin="anonymous"` to their script tags and have the CDN send an `Access-Control-Allow-Origin` header. Errors in third-party scripts you do not control stay hidden.

## What an error report sends

The error's type, such as `TypeError`, its message, and up to 5 frames of the stack, each with the file, line, column and function name. It also sends the page address and a random ID for the page view, to count views with errors. The stored report keeps the page path, the browser, its version and the operating system, and nothing that identifies the visitor.

Before anything is stored, ingest cleans each report:

- It drops query strings and fragments from file addresses, and query parameters from addresses in the message.
- It replaces email addresses with `[email]`.
- It replaces runs of five or more digits, such as phone and card numbers, with `[number]`.
- It replaces tokens of 16 or more letters and digits, such as session IDs, with `[id]`.
- It cuts messages at 500 characters.

The IP address is dropped in memory, as for every request. [Privacy and data](/docs/platform/privacy) covers the rest of what the script sends.

## Read it from the API

`GET https://api.ultanimus.com/v1/sites/{id}/errors`

`{id}` is the site ID or the site's domain. Every API key can read it, on Insight and Foresight.

- `range` (string): `7d`, `30d` or `90d`, counted back from now. The default is `30d`.
- `page` (string): Optional. One path, like `/checkout`, without its query string. Only the errors on that page count.

```bash
curl "https://api.ultanimus.com/v1/sites/YOUR_SITE_ID/errors?range=7d" \
  -H "Authorization: Bearer $API_KEY"
```

```json
{
  "status_code": 200,
  "data": {
    "domain": "example.com",
    "range": "7d",
    "from": "2026-10-17T00:00:00Z",
    "to": "2026-10-23T14:05:00Z",
    "errors": 1840,
    "before": 610,
    "visitors": 920,
    "views": 1280,
    "pageviews": 48200,
    "share": 0.0266,
    "groups": 14,
    "last": "2026-10-23T14:01:12Z",
    "watching": false,
    "series": [{ "day": "2026-10-22", "errors": 410 }],
    "top": [
      {
        "id": "8f3a9b2c1d4e5f60",
        "type": "TypeError",
        "message": "Cannot read properties of undefined (reading 'price')",
        "rejection": false,
        "errors": 980,
        "visitors": 560,
        "pages": 2,
        "first_seen": "2026-10-21T14:12:40Z",
        "last_seen": "2026-10-23T14:01:12Z",
        "new": true,
        "top_pages": [{ "path": "/checkout", "errors": 810 }],
        "browsers": [{ "browser": "safari", "version": "18", "os": "ios", "errors": 630 }],
        "stack": [{ "file": "example.com/assets/checkout.js", "line": 1, "column": 18234, "function": "Cart.total" }]
      }
    ],
    "new": []
  }
}
```

`top` holds the 30 busiest groups and `new` the 10 busiest that first appeared in the range. `new` is empty for `90d`. `series` leaves out days without errors. With no errors in the range, `errors` is `0`, the lists are empty, and `last` is the time of the newest error in the 90 days kept, or `null` when there is none. When `last` is `null`, `watching` is `true` if a page view in the last 7 days came with the add-on on.

## Limits

Error reports do not count toward your plan's events. Each month, an organization stores at most as many as its plan has events and drops the rest until the next month starts. Every plan collects them, so a site that moves up from Glance has its errors ready.
