**TL;DR:** Ratelimit analytics that you can trust: analytics true, pending awaited, and the dashboard as your source of truth. Use one prefix per limiter so dashboards do not mix unrelated limits. Keep the writes alive Analytics writes happen after limit() returns.

## The fix

# @upstash/ratelimit analytics you can trust

## Setup

const ratelimit = new Ratelimit({
  redis: Redis.fromEnv(),
  limiter: Ratelimit.slidingWindow(10, "10 s"),
  analytics: true,
  prefix: "@upstash/ratelimit",
});

The prefix namespaces the analytics keys. Use one prefix per
limiter so dashboards do not mix unrelated limits.

## Keep the writes alive

Analytics writes happen after limit() returns. On serverless:

const { pending } = await ratelimit.limit(id);
context.waitUntil(pending);

Without this, the dashboard undercounts. This is the number one
cause of analytics that do not match access logs.

## Read the dashboard

The Ratelimit dashboard in the console shows per-identifier
request and block counts, plus denied-request breakdowns by
country, IP, user agent, and identifier when protection is on.
Use it to:

- Find your heaviest identifiers before raising limits.
- Confirm deny-list blocks are hitting the right targets.
- Spot identifiers that are always at the ceiling: candidates
  for higher tiers or dedicated limits.

## Cost

Analytics adds one command per limit() call. Include it in your
per-request command math.

## Verify

Generate known traffic (e.g. 100 requests from a test identifier),
then check the dashboard shows roughly 100 with the right
allow/block split. If it is far off, pending is being dropped.

## When to use this

- This covers exactly what the title says: Ratelimit analytics you can trust.
- You are setting this up for the first time, or auditing an existing setup.
- You want the key gotchas in one place before you start.

## When not to use this

- You are doing a different workflow with Ratelimit; these steps are specific to the title above.
- You need the full reference docs; this is the short path, not the manual.

## Compatibility

- Not pinned to a specific version; follows current Ratelimit behavior.