Files
hanzo.ai/lib/analytics/noise.ts
zeekayandHanzo Dev ebbdea1890 A doubled slash at the front of an address is made one before the router reads it, a page from before a deploy reloads once when a chunk is gone, a scanner's or an extension's error is not counted as the site's, the lead and the cart send the names the tag table knows, and the gates drive a person's browser
- lib/head.ts: ONE_SLASH rewrites `//models/x` to `/models/x` in the head (the router's replaceState read `//models/x` as host `models` and the browser refused it); STALE reloads once per minute per tab on a ChunkLoadError and marks `window.hzStale`.
- lib/analytics/noise.ts and `<Errors/>`: unhandled errors are reported without Outlook's SafeLinks bridge, cross-origin `Script error.`, wallet extensions' `window.ethereum`, ResizeObserver's deferral, or a chunk failure being reloaded.
- `generate_lead` and `add_to_cart` are not events in @hanzo/events' table, so no platform was sent them: the sales lead is `sales_contacted`, the plan card's cart is `plan_selected`.
- `<html data-hydrated>` once the page has committed, for anything that presses.
- The home's sign-in panel on a guest host no longer leaves for hanzo.ai on arrival; /login and /signup still do.
- Gates: @hanzo/event 0.3.55 loads no pixel for a driven browser, so the tag gates start from a person's (one `person` in heard.ts); stale expectations follow the product (sign-in-first plan CTAs, /invite private, /bot/details, the home's structure, providers-wide `#choices`).

Co-authored-by: Hanzo Dev <[email protected]>
2026-10-01 16:42:46 -07:00

39 lines
1.8 KiB
TypeScript

/**
* Errors the page did not raise and cannot fix, kept out of error tracking.
*
* Outlook's link scanner `Object Not Found Matching Id:N, MethodName:update,
* ParamCount:4`, thrown by the CefSharp bridge it
* injects when it opens a mailed link
* another origin's script `Script error.`: the browser hides the rest, so
* there is nothing to read, group or fix
* a wallet extension `window.ethereum…`, written into the page by the
* extension, not by this site
* ResizeObserver `ResizeObserver loop completed with undelivered
* notifications`: the browser deferring a resize to
* the next frame, which is not a failure
*
* And a chunk failure the head is already recovering from (lib/head.ts `STALE`
* sets `window.hzStale` before it reloads): the reload is the fix, not an error.
*/
const NOISE = [
/^Object Not Found Matching Id:\d+, MethodName:\w+, ParamCount:\d+/,
/^Script error\.?$/,
/\bwindow\.ethereum\b/,
/^ResizeObserver loop (completed with undelivered notifications|limit exceeded)/,
]
/** The message an error event or a rejection carries, however it was thrown. */
function said(err: unknown): string {
if (typeof err === 'string') return err
if (err && typeof err === 'object' && 'message' in err) return String((err as { message: unknown }).message)
return ''
}
/** Whether `err` is one of the above: an error that is not this site's. */
export function noise(err: unknown): boolean {
if (typeof window !== 'undefined' && (window as { hzStale?: boolean }).hzStale) return true
const message = said(err)
return NOISE.some((re) => re.test(message))
}