navigator.webdriver is true for real, headed Chrome driven via CDP/ Playwright (the gstack/browse QA-testing tooling used to dogfood live sites), which carries an ordinary Chrome UA and so passed the server-side bot filter's UA regex uncaught -- every site on this tag (menivor.com included) was counting that traffic as real visitors. /s.js now skips sending anything, and never defines window.railyard, when navigator.webdriver is true or localStorage railyard_opt_out=1 is set. All 67 existing insights-edge tests still pass unmodified; the 3 KB gzip tag budget still holds. Not deployed this session (insights.ereboslab.com is under the standing ereboslab deploy freeze) -- noted in docs/FIRST-PARTY-SITES.md, along with the fact that traffic numbers quoted for any site in that table before today may include QA/dogfooding hits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Railyard Insights edge collector
A Cloudflare Worker (RYP-D3) that takes page views and custom events from the
/s.js page tag and hands them to Railyard Insights in batches.
POST /api/sendandPOST /api/batch(up to 100 events), in the same shape as the widely used open-source page-analytics payload, so existing tags work.GET /s.js: the page tag. No cookies, no local storage, nothing sent when Do Not Track is on.- Site-key check against the
SITESKV entries the console writes. - Bots, crawlers, link previews and prefetches are answered 202 and dropped.
- The visitor id is a salted hash that changes every UTC day. The IP is used only to compute it, in memory; it is never stored, logged or sent on.
- Plan caps per org and month, pooled across every site/app the org has (not
a separate allowance per site — a 3-app org cannot store 3x its plan's
events by spreading events across its 3 sites). Over the cap the answer is
still 202, with
x-railyard-capped: 1; those events are counted for usage but not stored. A paused org getsx-railyard-paused: 1. - One Durable Object per org buffers events and flushes every 2 seconds in one request, so each site sees at most one downstream request every 2 seconds.
- Once a minute each org's counts go to the usage meter as
insights_events($0 until paid overage is switched on). - Page speed (QY1.2): the page tag sends each page view's LCP, INP and CLS (and
FCP and TTFB) once, as a
performanceevent, when the page is hidden.data-vitals="off"on the script tag turns it off. The tag stays under 3 KB gzip. - With
PRODUCT_ANALYTICS_URLset, every stored event also goes to product analytics in its capture protocol (page views as$pageview, page speed as$web_vitals, a cookieless daily id for anonymous visitors), so the web view there reads the same store as funnels and replay. - Agent failures (2026-10-23): a page or SDK can send
railyard.track("$agent_failure", { agent, model, error }). Only those three fields are kept (src/agent-failure.mjs); a prompt, an API key or any other field is dropped before anything is stored or forwarded, and the event is missing without anagentand anerror. These rows sit in their own "Agent failures" table on the dashboard and the live demo, apart fromevents/converted. WithFAULTLINE_DSNset (a GlitchTip project DSN), each one is also posted to Faultline as an issue taggedagent/model, fingerprinted on(agent, error)so repeats group together.
Live (2026-10-08): https://insights.ereboslab.com with a D1 event store
(railyard-insights, binding DB; every stored event is written there at each
flush, no IP), GET /api/stats?days=N and POST /api/report behind
STATS_TOKEN, and a weekly funnel email (cron Mondays 07:00 UTC) to REPORT_TO
through Scribase Mail (key mk_3e204ab960f7f073, from no-reply@mail.menivor.com).
Sites are site:<key> entries in the SITES KV. inject/ is a pass-through
Worker on zone routes that adds the page tag to HTML at the edge (scribase.com,
mail.scribase.com, menivor.com); bidstage.app and yokharita.com carry the tag
in their own layouts. Secrets live in ~/.config/products-keys/railyard-insights.env.
Self-serve (2026-10-12): GET / is a public landing page with a sign-up form
(email + domain, works without JavaScript). POST /api/sites (JSON or form)
creates a site:s_... entry (10,000 stored events a month, self_serve: true,
KV list metadata so the weekly run skips it) and a private dashboard link
/d/<token> (only the token's SHA-256 is stored, as dash:<hash>), mailed
through Scribase Mail and shown at once. A self-serve site stores events only
from its own domain and subdomains. GET /api/d/<token>/stats?days=N is the
same data as JSON. POST /d/<token>/delete with confirm=<domain> removes the
site, the link, the signups row and every stored event. Limits: 3 sign-ups
per email and per domain a day, SIGNUP_DAILY_CAP in total. /privacy,
/robots.txt, /sitemap.xml. Stats and the weekly report also list page
views per utm_source; the owner report counts self-serve sites but never
itemises them.
The downstream contract is contract/INGEST-API.md (and its JSON schema). Until
Insights ingest is deployed, INGEST_URL is empty and events are counted and
capped but not forwarded.
Tests
pnpm install --filter @railyard/insights-edge
node --test test/*.test.mjs # workerd (local runtime) tests plus a 60 s simulated-clock run
node test/load.mjs 60 1000 # load run in the local runtime; results in LOAD-RESULT.md
Owner steps
wrangler kv namespace create SITESand put the id inwrangler.jsonc.wrangler secret put VISITOR_SALT_SECRET(32+ random bytes),INGEST_TOKEN,RAGO_API_KEY.- Deploy at the Wave E gate, after Insights ingest is up.
- Optional:
wrangler secret put FAULTLINE_DSNwith the real GlitchTip project DSN to turn on agent-failure forwarding; unset, the dashboard table still fills in, only the Faultline forward is skipped.