Skip to main content
The TypeScript seller SDK ships withPageViews, a fetch-handler wrapper that reports each page-content request to Page views. Mount it around the handler that serves your marketing site; agents, crawlers, and people all get your site exactly as before, and each page load is reported in the background. It implements one contract:
  • Only GET requests to non-asset paths are reported; assets and every other method pass through unobserved.
  • The handler runs first, so the beacon carries the real response status and the request duration. The visitor’s User-Agent, Accept, and connecting IP are forwarded for server-side classification.
  • The beacon is fire-and-forget and fails open. A missing key, a network error, a non-204, a timeout, or a malformed report is handed to onError and swallowed. The middleware never delays or breaks the page.

Standalone: no client required

Page views needs only the seller id and a zc_ key with the page-views:write scope. Unlike the usage or Agentify surfaces, there is no createSeller and no signing secrets — a site that only reports page views wires up nothing else.
Mount it in front of the pages people and agents read — your marketing routes — not in front of your billed API. Compose it with Agentify when you run both: wrap the same handler with each middleware, since the two are independent.

Options

Only the request’s path is reported, never its query string, so tracking parameters never reach ZeroClick.

Failing open, observably

The middleware exists to add a measurement, never to add an outage or a delay: any error on the reporting path leaves the response untouched. That silence is deliberate, and it means a misconfigured key looks exactly like a working page — so wire the error hook to your logger:

Other stacks

Any language or framework can report page views by calling the REST endpoint directly from the request that serves each page — the same body the middleware sends, once per page-content GET.

Next steps

REST endpoint

The underlying request: body, response, and errors.

Overview

What is captured, how viewers are classified, and the key scope.