> ## Documentation Index
> Fetch the complete documentation index at: https://docs.crispstats.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> CrispStats is a hosted, privacy-first web analytics product. It has no self-hosted edition, no session replay, no heatmaps, no A/B testing, no mobile SDKs and no data import except a site's history from a Plausible export (Settings, Import and export).
> The script global is crispstats(...), site keys start with cs_pk_ and secret API keys start with cs_sk_. The script is served from https://in.crispstats.com/d.js and the REST API lives at https://crispstats.com/api/v1.
> There is no npm package to install. Integrations copy the script tag, the queue stub, crispstats.d.ts and proxy code from these docs or from Settings, Tracking code in the dashboard. A first-party proxy forwards one path of the site to https://in.crispstats.com/p/ and forwards only content-type, user-agent, accept-language, referer, origin, if-none-match and x-forwarded-for, never cookies.

# Alert rule types reference

> Every CrispStats alert rule type: what it watches, the unit of its threshold, the windows the dashboard offers, its defaults and when it fires.

CrispStats has eleven alert rule types, grouped into traffic, conversions and revenue, health, and account. Each rule stores a type, a threshold, a time window and a cooldown. What the threshold means depends on the type: a ratio for traffic, a count for errors, an amount for revenue, milliseconds for web vitals and a share of your plan for usage. This page lists, for each type, the sentence you edit on the **Alerts** screen, the choices it offers, its defaults and exactly when it fires.

To create a rule, see [get alerted](https://docs.crispstats.com/alerts/overview.md).

## Summary

| Type | In **Watch for** | Threshold unit | Default threshold | Default window | Default cooldown |
| - | - | - | - | - | - |
| `traffic_spike` | Traffic spikes | Ratio to normal | 3× | 1 hour | 3 hours |
| `traffic_drop` | Traffic drops | Share of normal | Half | 6 hours | 6 hours |
| `no_traffic` | Traffic stops | None | None | 1 hour | 6 hours |
| `goal_completed` | A goal is completed | Completions | 1 | 5 minutes | Every time |
| `revenue_received` | A payment arrives | Minimum amount per payment | Any amount | None | Every time |
| `revenue_milestone` | Revenue passes an amount | Amount | 500.00 in the site's currency | See below | 1 day |
| `error_spike` | Errors spike | Errors | 50 | 1 hour | 1 hour |
| `new_error` | A new error appears | None | None | None | 1 hour |
| `vitals_regression` | The site gets slower | Milliseconds | LCP 2.5 s | 1 day | 1 day |
| `monitor_down` | A monitor goes down | None | None | None | 30 minutes |
| `usage_limit` | Usage nears the plan limit | Share of the plan's events | 80% | None | 1 day |

Amounts are entered in your site's currency, in major units (for example `500` for 500.00), and stored in minor units (cents).

## Traffic

Traffic rules compare a window with what is normal for the same hours of the week. Normal is the average of the same hours on the same weekday over the previous four weeks, counting only weeks after the site was installed. A rule needs at least two of those weeks before it can fire, so a new site stays quiet for its first two weeks.

Traffic rules are checked once per full hour in the site's timezone, a few minutes after the hour ends. Windows end on the hour, and a window shorter than an hour is checked as one full hour.

What is counted depends on the window: **visitors** for a one-hour window (the same number the dashboard shows for that hour), and **visits** for longer windows, because unique visitors do not add up across hours.

### Traffic spike

> Tell me when visitors in the last **hour** are **3×** the usual.

* **Window**: 15 minutes, 1 hour, 6 hours or 1 day. A 15-minute window is checked as one full hour.
* **Threshold**: 1.5×, 2×, 3×, 5× or 10× normal.
* **Fires when** the window's count reaches the threshold times normal, is above normal, and is at least 20.
* **Notice**: the count, the normal count, the ratio, the top source and the top page in the window.

### Traffic drop

> Tell me when visitors in the last **6 hours** fall below **half** of the usual.

* **Window**: 1 hour, 6 hours or 1 day.
* **Threshold**: a quarter, half or three quarters of normal.
* **Fires when** the window's count is at or below that share of normal, and normal is at least 20. Quiet sites do not fire.
* **Notice**: the count, the normal count and the change in percent, with a reminder to check that the tracking script still loads.

### No traffic

> Tell me when nobody has visited for **an hour**.

* **Window**: 30 minutes, 1 hour, 3 hours, 6 hours, 12 hours or 1 day. A 30-minute window is checked as one full hour.
* **Fires when** the window has no visits at all while normal for those hours is at least 5.
* **Notice**: the normal count for that window, with a reminder to check that the site is up and the script loads.

If every site on CrispStats went quiet in the same window, the cause is CrispStats's own pipeline, not your site, and traffic drop and no traffic rules stay silent.

## Conversions and revenue

### Goal completed

> Tell me when someone completes **any goal**.

* **Goal**: any goal, or one of the site's [goals](https://docs.crispstats.com/dashboard/goals.md).
* **Fires when** at least one completion of the goal (or of any goal) happened since the rule's last notice, within its 5-minute window. A goal on an event counts that event; a goal on a page counts pageviews of matching paths.
* **Checked** every minute. With **Every time**, completions are bundled into at most one notice a minute. With a longer cooldown, the next check after the cooldown counts only completions from the 5 minutes before it.
* **Notice**: the number of completions and, for several goals, the completions of each.

### Payment received

> Tell me when a payment of **any amount** arrives.

* **Threshold**: any amount, or 10, 50, 100, 500 or 1,000 or more in the site's currency.
* **Fires when** one or more payments at or above the amount arrived since the rule's last notice. Refunds are not counted.
* **Checked** every minute. Payments that arrive during the cooldown are reported together when it ends, going back at most one day.
* **Notice**: the number of payments, the total (per currency, the site's currency first), the product or the largest payment, and the top source of attributed payments.

### Revenue milestone

> Tell me when revenue in the last **day** passes **500.00**.

* **Threshold**: an amount you type, in the site's currency. It must be more than zero.
* **Fires when** net revenue, refunds taken off, reaches the amount. It fires once per period.
* **Checked** every 5 minutes.
* **Notice**: the revenue so far and the milestone.

> [!WARNING]
>
> The sentence offers **day** or **week**, but the check currently ignores that choice and measures net revenue of the current calendar month in the site's timezone. A rule fires once a month at most, when the month's revenue reaches the amount.

## Health

### Error spike

> Tell me when more than **50** errors happen within **an hour**.

* **Window**: 5 minutes, 15 minutes, 1 hour or 1 day.
* **Threshold**: a number of errors you type. It must be at least 1.
* **Fires when** the number of JavaScript errors in the last window reaches the threshold. The sentence says "more than", but a count equal to the threshold already fires. At most one notice per window.
* **Checked** every minute.
* **Notice**: the error count, the count in the window before, and the most frequent error with its occurrences.

Error rules need [error tracking](https://docs.crispstats.com/health/errors.md) turned on.

### New error

> Tell me when a JavaScript error appears that has not been seen before.

* **Fires when** an error group is first seen after the rule's last notice (or after the rule was created, at most one day back). Errors you marked **Ignored** never count. An error that was resolved and comes back is reopened, not new.
* **Checked** every minute. New groups found together go in one notice.
* **Notice**: how many new errors, and up to five of them, most frequent first, with their occurrences.

### Web vitals regression

> Tell me when **LCP** at the 75th percentile is slower than **2.50s, the limit for good** over the last **day**.

* **Metric**: LCP, INP, FCP or TTFB. CLS is not offered, because the threshold is in milliseconds.

* **Threshold**: the metric's limit for good, or the point where poor starts. Changing the metric resets the threshold to that metric's limit for good.

  | Metric | Limit for good | Where poor starts |
  | - | - | - |
  | LCP | 2.5 s | 4 s |
  | INP | 200 ms | 500 ms |
  | FCP | 1.8 s | 3 s |
  | TTFB | 800 ms | 1.8 s |

* **Window**: 1 hour, 6 hours, 1 day or 1 week.

* **Fires when** the 75th percentile over the window is above the threshold and the window has at least 20 samples. It fires once per episode: after a notice, it fires again only once the p75 has come back under the threshold (with at least 20 samples) and crossed it again.

* **Checked** every quarter of the window, at least every 5 minutes and at most every hour.

* **Notice**: the p75, your limit, the p75 in the window before, and the slowest page with at least 5 samples.

Web vitals rules need [web vitals](https://docs.crispstats.com/health/web-vitals.md) turned on.

### Monitor down

> Tell me when **any monitor** stops answering.

* **Monitor**: any monitor of the site, or one of them. See [uptime](https://docs.crispstats.com/health/uptime.md).
* **Fires when** an incident opens, which happens after two failed checks in a row, and again when it closes.
* **Not polled**: the notice is created the moment the incident opens or closes.
* **Cooldown** works as flap suppression, see [cooldown](https://docs.crispstats.com/alerts/overview.md#cooldown).
* **Notice**: on down, the monitor, its URL, the cause, the status code and when it went down. On recovery, how long it was down, when it went down and came back, and the cause.

## Account

### Usage limit

> Tell me when this month's events reach **80%** of the plan's allowance.

* **Threshold**: 80%, 90% or 100%.
* **Fires when** your workspace's events this calendar month (UTC) reach that share of the events your plan includes. It counts every site in the workspace, not just this one. It fires once per month for each threshold.
* **Checked** every 15 minutes.
* **Notice**: events used and events included, with a link to billing. On a paid plan nothing is dropped if you go over. In the trial, the workspace is paused at 100% until you pick a plan or the next month begins.

## Next steps

> [card] [Get alerted](https://docs.crispstats.com/alerts/overview.md)
>
> Create a rule, set its cooldown and read the delivery history.

> [card] [Channels](https://docs.crispstats.com/alerts/channels.md)
>
> Where notices go and what each message contains.

> [card] [Track JavaScript errors](https://docs.crispstats.com/health/errors.md)
>
> Turn on the error data that error rules watch.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.