@iann29/rastro 0.1.0-alpha.1 → 0.1.0-alpha.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. package/README.md +521 -66
  2. package/agent/integration.md +661 -0
  3. package/agent/manifest.json +187 -0
  4. package/agent/manifest.schema.json +411 -0
  5. package/dist/client/federation.d.ts +236 -0
  6. package/dist/client/federation.d.ts.map +1 -0
  7. package/dist/client/federation.js +196 -0
  8. package/dist/client/federation.js.map +1 -0
  9. package/dist/client/index.d.ts +2467 -18
  10. package/dist/client/index.d.ts.map +1 -1
  11. package/dist/client/index.js +461 -32
  12. package/dist/client/index.js.map +1 -1
  13. package/dist/component/_generated/api.d.ts +16 -0
  14. package/dist/component/_generated/api.d.ts.map +1 -1
  15. package/dist/component/_generated/api.js.map +1 -1
  16. package/dist/component/_generated/component.d.ts +302 -4
  17. package/dist/component/_generated/component.d.ts.map +1 -1
  18. package/dist/component/_generated/server.d.ts +4 -0
  19. package/dist/component/_generated/server.d.ts.map +1 -1
  20. package/dist/component/_generated/server.js.map +1 -1
  21. package/dist/component/affiliates.d.ts.map +1 -1
  22. package/dist/component/affiliates.js +6 -2
  23. package/dist/component/affiliates.js.map +1 -1
  24. package/dist/component/cardinality.d.ts +12 -0
  25. package/dist/component/cardinality.d.ts.map +1 -0
  26. package/dist/component/cardinality.js +94 -0
  27. package/dist/component/cardinality.js.map +1 -0
  28. package/dist/component/constants.d.ts +25 -1
  29. package/dist/component/constants.d.ts.map +1 -1
  30. package/dist/component/constants.js +38 -1
  31. package/dist/component/constants.js.map +1 -1
  32. package/dist/component/convex.config.d.ts +6 -1
  33. package/dist/component/convex.config.js +9 -1
  34. package/dist/component/convex.config.js.map +1 -1
  35. package/dist/component/coverage.d.ts +19 -0
  36. package/dist/component/coverage.d.ts.map +1 -0
  37. package/dist/component/coverage.js +30 -0
  38. package/dist/component/coverage.js.map +1 -0
  39. package/dist/component/diagnostics.d.ts +9 -0
  40. package/dist/component/diagnostics.d.ts.map +1 -0
  41. package/dist/component/diagnostics.js +47 -0
  42. package/dist/component/diagnostics.js.map +1 -0
  43. package/dist/component/errors.d.ts +1 -1
  44. package/dist/component/errors.d.ts.map +1 -1
  45. package/dist/component/errors.js.map +1 -1
  46. package/dist/component/eventStore.d.ts +21 -9
  47. package/dist/component/eventStore.d.ts.map +1 -1
  48. package/dist/component/eventStore.js +142 -152
  49. package/dist/component/eventStore.js.map +1 -1
  50. package/dist/component/funnels.d.ts.map +1 -1
  51. package/dist/component/funnels.js +5 -3
  52. package/dist/component/funnels.js.map +1 -1
  53. package/dist/component/geo.d.ts +71 -0
  54. package/dist/component/geo.d.ts.map +1 -0
  55. package/dist/component/geo.js +611 -0
  56. package/dist/component/geo.js.map +1 -0
  57. package/dist/component/goals.d.ts.map +1 -1
  58. package/dist/component/goals.js +8 -5
  59. package/dist/component/goals.js.map +1 -1
  60. package/dist/component/guards.d.ts.map +1 -1
  61. package/dist/component/guards.js.map +1 -1
  62. package/dist/component/http.d.ts.map +1 -1
  63. package/dist/component/http.js +248 -49
  64. package/dist/component/http.js.map +1 -1
  65. package/dist/component/identity.d.ts +13 -0
  66. package/dist/component/identity.d.ts.map +1 -0
  67. package/dist/component/identity.js +58 -0
  68. package/dist/component/identity.js.map +1 -0
  69. package/dist/component/ingest.d.ts +3 -1
  70. package/dist/component/ingest.d.ts.map +1 -1
  71. package/dist/component/ingest.js +604 -55
  72. package/dist/component/ingest.js.map +1 -1
  73. package/dist/component/live.d.ts.map +1 -1
  74. package/dist/component/live.js +7 -6
  75. package/dist/component/live.js.map +1 -1
  76. package/dist/component/reports.d.ts +259 -10
  77. package/dist/component/reports.d.ts.map +1 -1
  78. package/dist/component/reports.js +1110 -124
  79. package/dist/component/reports.js.map +1 -1
  80. package/dist/component/retention.d.ts +75 -1
  81. package/dist/component/retention.d.ts.map +1 -1
  82. package/dist/component/retention.js +537 -32
  83. package/dist/component/retention.js.map +1 -1
  84. package/dist/component/sanitize.d.ts +24 -1
  85. package/dist/component/sanitize.d.ts.map +1 -1
  86. package/dist/component/sanitize.js +96 -16
  87. package/dist/component/sanitize.js.map +1 -1
  88. package/dist/component/schema.d.ts +378 -62
  89. package/dist/component/schema.js +178 -20
  90. package/dist/component/schema.js.map +1 -1
  91. package/dist/component/sites.d.ts.map +1 -1
  92. package/dist/component/sites.js +11 -7
  93. package/dist/component/sites.js.map +1 -1
  94. package/dist/component/useragent.d.ts +9 -0
  95. package/dist/component/useragent.d.ts.map +1 -0
  96. package/dist/component/useragent.js +152 -0
  97. package/dist/component/useragent.js.map +1 -0
  98. package/dist/component/validators.d.ts +101 -65
  99. package/dist/component/validators.d.ts.map +1 -1
  100. package/dist/component/validators.js +19 -13
  101. package/dist/component/validators.js.map +1 -1
  102. package/dist/component/visitors.d.ts +19 -0
  103. package/dist/component/visitors.d.ts.map +1 -0
  104. package/dist/component/visitors.js +86 -0
  105. package/dist/component/visitors.js.map +1 -0
  106. package/dist/component/vitals.d.ts +41 -0
  107. package/dist/component/vitals.d.ts.map +1 -0
  108. package/dist/component/vitals.js +115 -0
  109. package/dist/component/vitals.js.map +1 -0
  110. package/dist/react/index.d.ts.map +1 -1
  111. package/dist/react/index.js.map +1 -1
  112. package/dist/tracker/generated.d.ts +8 -4
  113. package/dist/tracker/generated.d.ts.map +1 -1
  114. package/dist/tracker/generated.js +8 -4
  115. package/dist/tracker/generated.js.map +1 -1
  116. package/dist/tracker/tracker.d.ts +1 -1
  117. package/dist/tracker/tracker.d.ts.map +1 -1
  118. package/dist/tracker/tracker.js +57 -20
  119. package/dist/tracker/tracker.js.map +1 -1
  120. package/dist/tracker/vitals.d.ts +10 -0
  121. package/dist/tracker/vitals.d.ts.map +1 -0
  122. package/dist/tracker/vitals.js +140 -0
  123. package/dist/tracker/vitals.js.map +1 -0
  124. package/dist/tracker.min.js +1 -1
  125. package/dist/vitals.min.js +1 -0
  126. package/docs/benchmarks/2026-08-20-realistic.md +76 -76
  127. package/docs/benchmarks/2026-08-21-formal-certification.md +353 -0
  128. package/docs/benchmarks/2026-08-30-alpha6-recertification.md +206 -0
  129. package/docs/federation-setup.md +397 -0
  130. package/docs/federation.md +262 -0
  131. package/docs/upgrading.md +259 -0
  132. package/llms.txt +71 -0
  133. package/package.json +55 -11
  134. package/scripts/benchmark-ingest.mjs +175 -73
  135. package/scripts/generate-federation-keys.mjs +20 -0
  136. package/src/component/_generated/api.ts +16 -0
  137. package/src/component/_generated/component.ts +366 -4
  138. package/src/component/_generated/server.ts +4 -0
  139. package/src/component/affiliates.ts +20 -5
  140. package/src/component/cardinality.ts +117 -0
  141. package/src/component/constants.ts +38 -1
  142. package/src/component/convex.config.ts +11 -1
  143. package/src/component/coverage.ts +36 -0
  144. package/src/component/diagnostics.ts +65 -0
  145. package/src/component/errors.ts +2 -1
  146. package/src/component/eventStore.ts +217 -193
  147. package/src/component/funnels.ts +19 -16
  148. package/src/component/geo.ts +781 -0
  149. package/src/component/goals.ts +29 -21
  150. package/src/component/guards.ts +3 -1
  151. package/src/component/http.ts +357 -57
  152. package/src/component/identity.ts +74 -0
  153. package/src/component/ingest.ts +1040 -135
  154. package/src/component/live.ts +13 -7
  155. package/src/component/reports.ts +1675 -183
  156. package/src/component/retention.ts +770 -96
  157. package/src/component/sanitize.ts +144 -29
  158. package/src/component/schema.ts +200 -21
  159. package/src/component/sites.ts +27 -12
  160. package/src/component/useragent.ts +171 -0
  161. package/src/component/validators.ts +29 -13
  162. package/src/component/visitors.ts +116 -0
  163. package/src/component/vitals.ts +146 -0
package/README.md CHANGED
@@ -4,35 +4,86 @@
4
4
 
5
5
  Privacy-first, real-time web analytics built as an isolated Convex component.
6
6
 
7
- Amage Rastro combines a 1,022-byte gzip browser tracker with reactive traffic
7
+ Amage Rastro combines a 1.1 KB gzip browser tracker with reactive traffic
8
8
  metrics, a live visitor atlas, journey timelines, trusted payment attribution,
9
9
  goals, funnels, affiliates, and multi-site reports. Data and functions stay
10
10
  inside your Convex deployment.
11
11
 
12
12
  ![Amage Rastro Live Atlas](assets/rastro-live-atlas.png)
13
13
 
14
+ ## Project status
15
+
16
+ Amage Rastro is an actively developed alpha with a canonical batched event
17
+ store, protected CI, exact run-scoped benchmark reconciliation, and published
18
+ npm prereleases. The untagged `latest` channel intentionally remains on the
19
+ first public alpha. Federation consumers must statically inspect an
20
+ operator-approved exact registry artifact for every required runtime and type
21
+ export before changing a host; follow the gate in the
22
+ [federation setup runbook](docs/federation-setup.md). Never substitute a mutable
23
+ branch or website-supplied source tarball.
24
+
25
+ Public integration documentation is available at
26
+ [`www.amagerastro.com/docs/`](https://www.amagerastro.com/docs/). Coding agents
27
+ should start with [`llms.txt`](https://www.amagerastro.com/llms.txt) and verify
28
+ the [machine manifest](https://www.amagerastro.com/agent/manifest.json).
29
+
30
+ Current evidence supports more than 140 million stored events/day for realistic
31
+ traffic and more than 178 million for lean traffic. Near-limit heavy payloads
32
+ are certified at 55.26 million/day on a data-heavy store (76.62 million/day on a
33
+ fresh store, 2026-08-22). The feature-saturated profile currently fails
34
+ certification on a known rollup-contention defect
35
+ ([#52](https://github.com/amageweb/amage-rastro/issues/52)). Workload-specific
36
+ results and caveats are reported separately rather than collapsed into one
37
+ capacity claim.
38
+
14
39
  ## What ships
15
40
 
16
- | Capability | Implementation |
17
- | --------------------------- | --------------------------------------------------------------------------------------------------- |
18
- | Live visitor map | Reactive live sessions with coarse city-level coordinates and TTL expiry |
19
- | Traffic analytics | Sharded hour/day rollups, time series, top pages, sources, countries, devices, browsers, and events |
20
- | Journey replay | Bounded pageview/click/custom-event timelines; no DOM, keystroke, or form-value recording |
21
- | Payment conversion tracking | Trusted server-side ledger with idempotent event IDs and canonical site currency |
22
- | Goals and funnels | Exact pageview/custom-event goals and ordered conversion funnels |
23
- | Affiliates | Referral attribution, trusted revenue, and commission accounting |
24
- | Cross-site analytics | Reports over up to ten authorized site IDs with a preloaded pseudonymous visitor ID |
25
- | Auto-captured clicks | Anchors, buttons, outbound links, and explicit `data-rastro-event` controls |
26
- | Cookieless mode | Session-scoped pseudonymous IDs in `sessionStorage`; no cookies |
27
- | Tiny tracker | 1,909 bytes raw, 1,022 bytes gzip; the test suite enforces `< 1,024` bytes |
28
-
29
- ## Install
41
+ | Capability | Implementation |
42
+ | --------------------------- | --------------------------------------------------------------------------------------------------------- |
43
+ | Live visitor map | Reactive live sessions with city-level coordinates, realtime departures, and a 90-second safety net |
44
+ | Traffic analytics | Sharded hour/day rollups, time series, top pages, sources, countries, devices, browsers, and events |
45
+ | Field Web Vitals | Opt-in tracker module reporting LCP, CLS, INP, FCP, and TTFB into bounded per-page daily histograms |
46
+ | Site map | Daily per-route rollups: entries, derived exits and bounces, time on page, and route-to-route transitions |
47
+ | Journey replay | Bounded pageview/click/custom-event timelines; no DOM, keystroke, or form-value recording |
48
+ | Payment conversion tracking | Trusted server-side ledger with idempotent event IDs and canonical site currency |
49
+ | Goals and funnels | Exact pageview/custom-event goals and ordered conversion funnels |
50
+ | Affiliates | Referral attribution, trusted revenue, and commission accounting |
51
+ | Cross-site analytics | Reports over up to ten authorized site IDs with a preloaded pseudonymous visitor ID |
52
+ | Automatic GeoIP | Opt-in native request metadata plus IPinfo/IPWhois fallback; bounded quota and no raw-IP persistence |
53
+ | Auto-captured clicks | Anchors, buttons, and `data-rastro-event` controls with a bounded visible label; outbound origin+path |
54
+ | Bot filtering | Self-declared crawlers, unfurlers, monitors, HTTP libraries, and headless browsers rejected at ingestion |
55
+ | Cookieless mode | No cookies: persistent pseudonymous visitor id in `localStorage`, per-tab session id in `sessionStorage` |
56
+ | Tiny tracker | 2,132 bytes raw, 1,127 bytes gzip; the test suite enforces `< 1,280` bytes gzip |
57
+
58
+ ## Quickstart
59
+
60
+ ### Prerequisites
61
+
62
+ - Convex `^1.43.0` or a compatible Synapse deployment.
63
+ - An existing host authentication provider for administrative and local report
64
+ functions. The browser ingestion route itself is public and origin-checked.
65
+ - Two deployment origins recorded separately:
66
+
67
+ | Purpose | Convex Cloud example | Synapse example |
68
+ | ------------------------------ | ------------------------------ | -------------------------------------- |
69
+ | Functions and reactive queries | `https://project.convex.cloud` | `https://project.synapse.example` |
70
+ | HTTP actions and tracker | `https://project.convex.site` | `https://project.site.synapse.example` |
71
+
72
+ Never append `/rastro/tracker.js` to the functions URL.
73
+
74
+ ### 1. Install
30
75
 
31
76
  ```bash
32
- npm install @iann29/rastro
77
+ npm install @iann29/rastro@alpha
33
78
  ```
34
79
 
35
- Mount the component under an HTTP prefix:
80
+ The untagged npm `latest` channel intentionally remains on the first public
81
+ alpha. Use `@alpha` until a stable release is promoted.
82
+
83
+ ### 2. Mount the component
84
+
85
+ Merge the component into the project's existing configuration; preserve every
86
+ component and environment binding already registered there.
36
87
 
37
88
  ```ts
38
89
  // convex/convex.config.ts
@@ -45,14 +96,128 @@ app.use(rastro, { httpPrefix: "/rastro/" });
45
96
  export default app;
46
97
  ```
47
98
 
48
- This creates isolated component tables and three HTTP routes:
99
+ This creates isolated component tables and five HTTP routes:
49
100
 
50
101
  - `POST /rastro/events` — browser event ingestion
51
102
  - `OPTIONS /rastro/events` — CORS preflight
52
103
  - `GET /rastro/tracker.js` — the pre-gzipped tracker
104
+ - `GET /rastro/vitals.js` — the pre-gzipped, opt-in Web Vitals module
53
105
  - `GET /rastro/health` — integration health
54
106
 
55
- ## Create a site
107
+ Push the component and regenerate host bindings before importing
108
+ `components.rastroAnalytics`:
109
+
110
+ ```bash
111
+ # Convex Cloud development deployment
112
+ npx convex dev
113
+
114
+ # Synapse development deployment
115
+ synapse dev --once
116
+ ```
117
+
118
+ For production, use the product's existing release workflow. On an uncoordinated
119
+ Convex project that is `npx convex deploy`; on Synapse use
120
+ `synapse release --execute` when the project has a release manifest, otherwise
121
+ `synapse deploy`. Never deploy before confirming the target.
122
+
123
+ Verify the HTTP origin independently from the functions origin:
124
+
125
+ ```bash
126
+ curl -fsS https://YOUR_HTTP_ORIGIN/rastro/health
127
+ ```
128
+
129
+ A successful health response proves that the component HTTP routes are mounted;
130
+ it does not prove that a browser event was accepted.
131
+
132
+ ### Automatic GeoIP
133
+
134
+ Rastro uses Convex request metadata as the canonical client IP and can resolve
135
+ coarse city-level coordinates on the first request of each session. GeoIP is
136
+ opt-in because the configured provider receives the request IP. For IPinfo Core:
137
+
138
+ ```ts
139
+ // convex/convex.config.ts
140
+ import { defineApp } from "convex/server";
141
+ import { v } from "convex/values";
142
+ import rastro from "@iann29/rastro/convex.config.js";
143
+
144
+ const app = defineApp({ env: { IPINFO_TOKEN: v.string() } });
145
+ app.use(rastro, {
146
+ httpPrefix: "/rastro/",
147
+ env: {
148
+ RASTRO_GEOIP_PROVIDER: "ipinfo",
149
+ RASTRO_GEOIP_TOKEN: app.env.IPINFO_TOKEN,
150
+ RASTRO_GEOIP_DAILY_LIMIT: "1000",
151
+ },
152
+ });
153
+
154
+ export default app;
155
+ ```
156
+
157
+ `ipwhois` is also supported. Its token is optional for the documented
158
+ 1,000-request/day free endpoint and recommended for production. Bind it as
159
+ `RASTRO_GEOIP_TOKEN` in the same way as the IPinfo example.
160
+ `RASTRO_GEOIP_DAILY_LIMIT` defaults to 1,000 lookups per site per UTC day and
161
+ may be set from `0` through `1000000` to match the provider plan. Admission is
162
+ transactional, so concurrent first-session requests cannot exceed the cap.
163
+
164
+ When Rastro runs behind a reverse proxy that supplies `X-Forwarded-For` or
165
+ Vercel/Cloudflare geographic headers, explicitly bind
166
+ `RASTRO_TRUST_PROXY: "true"`. Leave it unset for direct Convex deployments.
167
+ Rastro uses forwarded data only when this opt-in is enabled and the runtime IP
168
+ identifies a private immediate peer. Caller-supplied proxy or geographic headers
169
+ are ignored when native metadata is absent or public.
170
+
171
+ The lookup has a 1.5-second timeout and fails open: telemetry ingestion
172
+ continues without location when the provider is unavailable. A session reserves
173
+ its single lookup attempt atomically only after its initial event is persisted;
174
+ heartbeats and concurrent duplicate requests do not consume provider quota. The
175
+ raw IP is never passed to a mutation or stored in component tables; only
176
+ sanitized country, city, and coordinates rounded to one decimal place are
177
+ persisted.
178
+
179
+ `GET /rastro/health` reports whether the runtime exposes a usable client IP and
180
+ whether GeoIP is configured and the daily cap, without returning the address or
181
+ token. Deployment administrators can exercise the configured provider through
182
+ the internal `geo:probe` action. If health reports no usable client IP, use
183
+ trusted Vercel/Cloudflare geographic headers with `RASTRO_TRUST_PROXY` or fix
184
+ the deployment's proxy forwarding.
185
+
186
+ ### Browser and device classification
187
+
188
+ The tracker sends no client identification. Ingestion derives `browser`, `os`,
189
+ and `device` from headers the browser attaches itself, and persists only those
190
+ three normalized values; the raw `User-Agent` never reaches a mutation or a
191
+ component table.
192
+
193
+ Chromium attaches the low-entropy `Sec-CH-UA`, `Sec-CH-UA-Mobile`, and
194
+ `Sec-CH-UA-Platform` client hints to cross-origin requests from secure origins,
195
+ with no `Accept-CH` opt-in required of the tracked site. They are preferred when
196
+ present, because they are the only signal separating Brave, Opera, Vivaldi,
197
+ Samsung Internet, Yandex, and bare Chromium from Chrome: Brave ships Chrome's
198
+ `User-Agent` verbatim by design. Hint brands are allowlisted, so an unrecognized
199
+ or forged brand falls back to the `User-Agent` instead of entering the browser
200
+ dimension verbatim.
201
+
202
+ The `User-Agent` remains the fallback for Firefox and Safari, which implement no
203
+ client hints, and for insecure origins, which receive none. Known limits of that
204
+ path:
205
+
206
+ - iPadOS 13+ requests sites with a Macintosh `User-Agent` by default and Safari
207
+ sends no hints, so those sessions are reported as desktop macOS.
208
+ - Without hints every Android client is reported as mobile;
209
+ `Sec-CH-UA-Mobile: ?0` on the Android platform is the only available tablet
210
+ signal, because the explicit `Sec-CH-UA-Form-Factors` hint is high entropy and
211
+ would require an `Accept-CH` opt-in and a permissions-policy delegation from
212
+ every tracked site.
213
+ - Known bots are rejected at ingestion by `User-Agent`: self-declared crawlers,
214
+ link unfurlers, uptime monitors, HTTP libraries, headless browsers, and any
215
+ agent carrying a URL. The response keeps the usual counters with `rejected`
216
+ set and adds `X-Rastro-Rejected: bot`; overview metadata reports
217
+ `botDetection` as `userAgent`. A scripted browser that spoofs a stock
218
+ `User-Agent` is still counted as an ordinary session.
219
+
220
+ ### 3. Create a site
56
221
 
57
222
  Components cannot read the host app's authentication state. The host must
58
223
  authenticate the caller and pass an opaque owner ID.
@@ -78,7 +243,7 @@ export const createSite = mutation({
78
243
  if (!identity) throw new Error("Not authenticated");
79
244
 
80
245
  return await analytics.createSite(ctx, {
81
- ownerId: identity.subject,
246
+ ownerId: identity.tokenIdentifier,
82
247
  name: args.name,
83
248
  domains: args.domains,
84
249
  currency: args.currency,
@@ -88,12 +253,30 @@ export const createSite = mutation({
88
253
  });
89
254
  ```
90
255
 
256
+ Call this mutation from the host application's authenticated administration UI
257
+ and persist or display the returned `siteId`:
258
+
259
+ ```tsx
260
+ const createSite = useMutation(api.analyticsAdmin.createSite);
261
+ const siteId = await createSite({
262
+ name: "Amage Product",
263
+ domains: ["product.example.com", "localhost"],
264
+ currency: "BRL",
265
+ });
266
+ ```
267
+
268
+ Do not call the authenticated example with a bare CLI command: without an
269
+ explicit test identity, `ctx.auth.getUserIdentity()` correctly returns `null`.
270
+
91
271
  Allowed domains are checked at ingestion. Exact hosts and wildcard subdomains
92
272
  such as `*.example.com` are supported. `Origin` is an abuse signal, not
93
273
  authentication; Amage Rastro also enforces per-session and fixed-shard per-site
94
274
  event/byte budgets.
95
275
 
96
- ## Add the tracker
276
+ Domain entries are hostnames, not host-and-port pairs. Use `localhost` or a full
277
+ origin such as `http://localhost:3000`; both normalize to the `localhost` host.
278
+
279
+ ### 4. Add the tracker
97
280
 
98
281
  Use the HTTP-actions URL for your deployment, not the Convex function URL.
99
282
 
@@ -123,8 +306,34 @@ serves the script and ingestion from different origins:
123
306
  ></script>
124
307
  ```
125
308
 
309
+ ### Field Web Vitals (optional)
310
+
311
+ A second, separate module measures real-visitor LCP, CLS, INP, FCP, and TTFB
312
+ with `PerformanceObserver` and reports them once per page load, when the tab is
313
+ first hidden. It stays out of `tracker.js` so the base tracker keeps its byte
314
+ budget; add it only where you want performance data:
315
+
316
+ ```html
317
+ <script
318
+ defer
319
+ data-site="YOUR_SITE_ID"
320
+ src="https://YOUR_DEPLOYMENT.convex.site/rastro/vitals.js"
321
+ ></script>
322
+ ```
323
+
324
+ The module shares the tracker's session identity through `sessionStorage`,
325
+ accepts the same `data-endpoint` and `data-visitor` overrides, and works with or
326
+ without the base tracker on the page. Measurements are attributed to the landing
327
+ path of the page load, never to later SPA routes. Vitals feed only the
328
+ `vitalsReport` histograms — analytics event counts, sessions, and live presence
329
+ do not change. Browsers without an entry type simply skip that metric (Safari
330
+ reports no LCP, CLS, or INP).
331
+
126
332
  ### React
127
333
 
334
+ React is an optional peer dependency. It is required only when importing the
335
+ `@iann29/rastro/react` entry point; backend-only consumers do not need it.
336
+
128
337
  ```tsx
129
338
  import { useState } from "react";
130
339
  import { RastroScript, useRastro } from "@iann29/rastro/react";
@@ -154,6 +363,26 @@ the same value on authorized sites to connect their journeys. Amage Rastro
154
363
  intentionally has no mutable post-load `identify` command: changing identity
155
364
  after a session starts would make the session ambiguous.
156
365
 
366
+ ### 5. Verify ingestion
367
+
368
+ 1. Open an allowed site origin in a fresh browser tab.
369
+ 2. In browser developer tools, filter Network requests by `rastro/events`.
370
+ 3. Wait for the normal tracker flush, which is debounced by approximately 1.2
371
+ seconds.
372
+ 4. Confirm `POST /rastro/events` returns HTTP 200 and a response containing
373
+ `accepted`, `duplicates`, and `rejected` counters.
374
+ 5. Run one authenticated local report, such as `analytics:overview`, for the
375
+ returned `siteId` and a complete UTC hour/day range.
376
+
377
+ The tracker intentionally does not interrupt the product UI when transport
378
+ fails. A loaded `tracker.js` or successful `/health` response alone is not proof
379
+ of ingestion. The usual causes of a rejected or missing request are:
380
+
381
+ - using the functions URL instead of the HTTP-actions URL;
382
+ - omitting the exact browser host from the site's `domains`;
383
+ - including query strings or paths in a configured base URL;
384
+ - querying a partial UTC bucket or a site the authenticated user does not own.
385
+
157
386
  ## Track custom events
158
387
 
159
388
  ```js
@@ -168,6 +397,12 @@ For declarative click capture:
168
397
  </button>
169
398
  ```
170
399
 
400
+ Auto-captured clicks record the control's visible text, bounded to 64 characters
401
+ and whitespace-normalized, so journeys read "Clicked «View pricing»" without
402
+ annotation. `data-rastro-label` replaces that text; use it on controls whose
403
+ copy may contain personal data. Input values are never read. Outbound links keep
404
+ their origin and pathname; internal links keep the pathname.
405
+
171
406
  Properties accept bounded string, number, boolean, or null values. Never send
172
407
  emails, names, form values, secrets, or other personal data as analytics
173
408
  properties.
@@ -178,6 +413,47 @@ session or with a timestamp in another minute is allowed. The tracker preserves
178
413
  timestamps when retrying. Trusted payment event IDs remain separately
179
414
  payload-bound by the site's financial ledger.
180
415
 
416
+ ## Attribute campaigns
417
+
418
+ The tracker reads `utm_source`, `utm_medium`, `utm_campaign`, `utm_term`, and
419
+ `utm_content` from the landing URL, keeps them in `sessionStorage` for the rest
420
+ of the session, and sends them as properties of every pageview; no other query
421
+ parameter ever leaves the page. A session's `source` is the lowercase
422
+ `utm_source` when present and the referrer host otherwise, so campaign traffic
423
+ no longer reads as `direct`. `utmSource`, `utmMedium`, and `utmCampaign` stay on
424
+ the session for journeys, and `overview.topCampaigns` ranks `utm_campaign` by
425
+ event volume next to `topSources`.
426
+
427
+ ## Identify visitors after signup
428
+
429
+ Anonymous sessions carry a random `visitorId` until the host supplies a
430
+ pseudonymous one through `data-visitor` or the `RastroScript` `visitorId` prop.
431
+ To keep the anonymous history when a visitor creates an account or signs in,
432
+ link the two ids from the trusted server path, never from the browser:
433
+
434
+ ```js
435
+ const { visitorId: anonymousVisitorId } = window.rastro("context");
436
+ // Send anonymousVisitorId with the signup or sign-in request.
437
+ ```
438
+
439
+ ```ts
440
+ await analytics.linkVisitor(ctx, {
441
+ siteId,
442
+ visitorId: user.analyticsId, // the value later passed to the tracker
443
+ previousVisitorId: anonymousVisitorId,
444
+ });
445
+ ```
446
+
447
+ `visitorJourney` for either id then returns one chronological journey; every
448
+ event keeps the id it was recorded with. Links are idempotent, an anonymous id
449
+ belongs to at most one identity, a linked id cannot be linked again, chains and
450
+ identity merges are rejected, and an identity holds at most ten aliases. The
451
+ tracker still sets no cookie: the host's own session identifies the account and
452
+ the anonymous ids live in the browser's own storage (the visitor id in
453
+ `localStorage`, the session id in `sessionStorage`). Linking anonymous history
454
+ to an account turns it into personal data under the host's privacy policy;
455
+ disclose it and offer an opt-out.
456
+
181
457
  ## Attribute trusted payments
182
458
 
183
459
  Browser-created conversion events are untrusted telemetry and never affect
@@ -239,6 +515,7 @@ export const {
239
515
  goalsReport,
240
516
  funnelsReport,
241
517
  affiliatesReport,
518
+ siteMap,
242
519
  } = exposeAnalyticsApi(components.rastroAnalytics, {
243
520
  authorize: async (ctx, request) => {
244
521
  const identity = await ctx.auth.getUserIdentity();
@@ -246,12 +523,12 @@ export const {
246
523
 
247
524
  for (const siteId of request.siteIds) {
248
525
  const site = await analytics.getSite(ctx, siteId);
249
- if (!site || site.ownerId !== identity.subject) {
526
+ if (!site || site.ownerId !== identity.tokenIdentifier) {
250
527
  throw new Error("Not authorized for analytics site");
251
528
  }
252
529
  }
253
530
 
254
- if (request.ownerId && request.ownerId !== identity.subject) {
531
+ if (request.ownerId && request.ownerId !== identity.tokenIdentifier) {
255
532
  throw new Error("Not authorized for analytics owner");
256
533
  }
257
534
  },
@@ -262,45 +539,141 @@ Do not copy the unauthenticated demo boundary into production. The included demo
262
539
  exposes only fixed-scope read reports plus bounded, idempotent seed/live-refresh
263
540
  functions.
264
541
 
542
+ ### Federated dashboard backend
543
+
544
+ The reference control plane in `control-plane/` can connect a central dashboard
545
+ while telemetry remains in the customer's deployment. It uses
546
+ `exposeFederatedAnalyticsApi` with issuer and connection-resolver options. The
547
+ helper constructs its authorization boundary internally; it cannot accept a
548
+ permissive host authorizer. Its surface contains a public protocol v1 manifest,
549
+ authenticated redacted connection status, redacted site summaries, and only the
550
+ reactive dashboard report queries.
551
+
552
+ The JWT only identifies the requested connection. Site access remains
553
+ authoritative in a local host record resolved on every query, so revocation is
554
+ immediate and a token cannot grant itself another site. `listSites` accepts no
555
+ site arguments and omits owner, domain, and network configuration. Stable
556
+ manifest names, capabilities, limits, and authorization error codes are exported
557
+ for connector clients. The host must already have Convex authentication and a
558
+ local authoritative grant. Follow
559
+ [`docs/federation-setup.md`](docs/federation-setup.md) for the executable setup
560
+ and verification sequence; use [`docs/federation.md`](docs/federation.md) as the
561
+ protocol reference. The production control plane is available at
562
+ `https://www.amagerastro.com`; before connecting a customer deployment, verify
563
+ the selected package exports the federation helper as shown in the setup
564
+ runbook.
565
+
265
566
  ## Backend API
266
567
 
267
568
  The `Rastro` class wraps the component boundary for host functions:
268
569
 
269
570
  - Sites: `createSite`, `updateSite`, `getSite`, `listSites`
270
- - Ingestion: `ingest`, `trackConversion`
571
+ - Ingestion: `ingest`, `trackConversion`, `linkVisitor`
271
572
  - Reports: `overview`, `liveVisitors`, `listSessions`, `sessionJourney`,
272
573
  `listConversions`, `visitorJourney`, `goalsReport`, `funnelsReport`,
273
- `affiliatesReport`
574
+ `affiliatesReport`, `vitalsReport`, `siteMap`, `dataCoverage`
274
575
  - Configuration: `upsertGoal`, `listGoals`, `removeGoal`, `upsertFunnel`,
275
576
  `listFunnels`, `removeFunnel`, `upsertAffiliate`, `listAffiliates`,
276
577
  `removeAffiliate`
277
- - Retention: `cleanup`
578
+ - Retention: `cleanup`, `setRetentionPolicy`, `disableRetentionPolicy`,
579
+ `runRetentionPolicy`, `retentionStatus`
278
580
 
279
581
  Every public function has argument and return validators. Growing reads are
280
582
  indexed and bounded. Component pagination uses scope-bound opaque keyset cursors
281
583
  because native `.paginate()` is not supported inside Convex components; page
282
584
  cost stays constant instead of increasing with an offset.
283
585
 
586
+ `siteMap` reads the daily route rollups newest day first and returns per-route
587
+ totals — pageviews, estimated visitors, entries, derived exits and bounces
588
+ (`exits = entries + transitions in − transitions out`,
589
+ `bounces = entries − sessions that continued`), and time on page — plus
590
+ route-to-route transition counts and a per-route daily series. Numeric, UUID,
591
+ and long hexadecimal path segments collapse to `:id` in the map only; the
592
+ package exports `normalizeRoute` so dashboards bucket live visitors by the same
593
+ rule, and `liveVisitors` reports `previousPath` and `movedAt` when a visitor
594
+ moves between routes. Map coverage begins at the first ingest after the upgrade
595
+ that introduced the rollups.
596
+
597
+ Overview responses label visitor values as either HLL-estimated unique visitors
598
+ or legacy `bucketOccurrences`; legacy aggregate rows are never presented as
599
+ exact uniques. Anonymous visitors carry a persistent pseudonymous id from the
600
+ tracker's `localStorage`, so the same person counts once across tabs, days, and
601
+ returns. When storage is blocked or an old cached tracker reports no id,
602
+ sessions from the same device and network within one UTC day still fold into one
603
+ visitor through a salted daily key; runtimes without a client IP fall back to
604
+ one visitor per session, which `/rastro/health` reports as
605
+ `uniqueVisitors: "session"` instead of `"dailyHash"`. Breakdown metadata
606
+ likewise identifies page, source, country, device, browser, and event rankings
607
+ as event-volume counts. Feature status is explicit: outbound-link event volume
608
+ is supported, bot detection rejects self-declared agents by `User-Agent`, and
609
+ session replay and error insights are currently unsupported.
610
+
611
+ All report ranges use integer Unix milliseconds with inclusive `from` and `to`
612
+ boundaries. Range metadata reports `boundary: "inclusive"` and
613
+ `timezone: "UTC"`; the site's timezone is presentation metadata and never
614
+ changes report bucket boundaries. Overview queries must contain complete UTC
615
+ hours or days, and funnel and affiliate reports must contain complete UTC days.
616
+ Those aggregate-backed reports fail with `REPORT_INCOMPLETE` instead of silently
617
+ including the rest of a partial bucket. Goal reports retain exact millisecond
618
+ filtering while bounded goal-completion rows are available.
619
+
620
+ Goal, funnel, and affiliate reports use definition-ID keyed daily rollups when
621
+ the low-churn rollout control proves that generation is available. Each loader
622
+ enforces day, row, document, and byte headroom before returning a complete
623
+ result; it never returns a silently truncated report. Ordinary ingestion never
624
+ patches or schedules work against a shared coverage document. `dataCoverage`
625
+ derives availability through bounded indexed reads of source and rollup records,
626
+ while the control document stores only rollout generation and durable retention
627
+ watermarks. Heartbeats can advance session availability but do not claim event
628
+ or aggregate availability. Hourly and daily overview availability are reported
629
+ separately as `overviewHour` and `overviewDay` because their retention
630
+ boundaries use different bucket alignment.
631
+
284
632
  ## Operational limits
285
633
 
286
634
  - HTTP body: 64 KiB
287
635
  - Events per batch: 50
288
636
  - Session-minute groups per batch: 4
289
637
  - Active goals per exact matcher: 1
638
+ - Web Vitals pages per site and UTC day: 48 tracked page rows, then `(other)`;
639
+ device classes are fixed (desktop, mobile, tablet, unknown)
640
+ - Web Vitals report: complete reads bounded to 5,000 rollup rows across at most
641
+ 90 UTC days; wider saturated ranges fail with `REPORT_INCOMPLETE`
642
+ - Site map routes per site-day shard: 200 tracked route rows, then `(other)`; 24
643
+ outgoing-transition slots per route row
644
+ - Site map report: reads newest day first, bounded to 8,000 rollup rows across
645
+ at most 90 UTC days; older days beyond the budget are declared as partial
646
+ coverage instead of failing the report
290
647
  - Primary aggregate shards: 256 hourly and 128 daily, derived from stable
291
648
  session identity
292
649
  - Funnel and affiliate aggregate shards: 16
293
- - Site ingress budget: 4,096 deterministic per-minute shards, each capped at
294
- 300 events and 512 KiB (1,228,800 admitted events/minute at uniform load)
650
+ - Site ingress budget: 4,096 deterministic per-minute shards, each capped at 300
651
+ events and 512 KiB (1,228,800 admitted events/minute at uniform load)
295
652
  - Rate-window storage: one reusable row per active session and site shard
296
- - Live session timeout: 60 seconds with one bounded five-second expiry sweep per
297
- site; legacy per-session jobs hand off to that sweep during the cutover
653
+ - Live session timeout: a `leave` beacon on `pagehide` retires the visitor about
654
+ ten seconds after they leave and a back/forward-cache return revives them
655
+ immediately; the safety net for a browser that never says goodbye is 90
656
+ seconds since the last event or heartbeat (heartbeats fire every 20 seconds,
657
+ within background-tab throttling), with one bounded five-second expiry sweep
658
+ per site; legacy per-session jobs hand off to that sweep during the cutover
659
+ - Clock alignment: the tracker and the vitals module stamp each batch with
660
+ `sentAt`; when that clock is more than 30 seconds from the server's, every
661
+ event in the batch is re-anchored by the offset before ingestion, so a visitor
662
+ whose device clock is wrong still goes live and is filed under the right hour
298
663
  - Dashboard overview: up to ten sites and bounded report ranges
299
664
  - Hourly overview: up to 24 hours; wider ranges use daily buckets
300
- - Retention cleanup: bounded batches; schedule host maintenance for the data
301
- classes your policy retains. The `events` cleanup kind covers both legacy
302
- event rows and new event batches and processes at most 32 heavy batches per
303
- transaction.
665
+ - Retention cleanup: bounded batches. `setRetentionPolicy` automatically starts
666
+ leased, persisted cleanup chains for every policy-managed dataset; interrupted
667
+ attempts resume after lease expiry and stale generations cannot mutate the
668
+ active chain. A completed chain schedules its next cycle after one day and
669
+ recomputes its cutoff from the then-current policy. Policy updates replace the
670
+ generation, and `disableRetentionPolicy` makes every queued attempt stale.
671
+ `runRetentionPolicy` remains available for an explicit bounded run. The
672
+ `events` cleanup kind removes canonical event-batch documents and processes at
673
+ most 32 heavy batches per transaction.
674
+ - Retention cutoffs are bucket-safe: event minutes, hourly aggregates, daily
675
+ aggregates and feature rollups preserve the bucket containing a cutoff and
676
+ return the exact effective `before` boundary they applied.
304
677
 
305
678
  Capacity claims use declared workload profiles. Complete release evidence
306
679
  reports ten-minute `lean`, `realistic`, `heavy`, and browser `feature` profiles
@@ -308,12 +681,63 @@ separately. The browser `feature` profile exercises configured goals, funnels,
308
681
  and affiliate attribution; trusted conversions require a separate server-side
309
682
  driver and certification result.
310
683
 
311
- The historical development evidence and its certification caveats are recorded
312
- in [`docs/benchmarks/2026-08-20-realistic.md`](docs/benchmarks/2026-08-20-realistic.md).
684
+ ### Certified ingest evidence (2026-08-30)
685
+
686
+ | Profile | Workload | Certified stored/day | p95 latency | 100M/day target |
687
+ | --------- | ------------------------------------------------- | -------------------: | ----------: | --------------- |
688
+ | Lean | Minimal events, maximum batches | 178.95M | 4,167 ms | Pass |
689
+ | Realistic | Reused sessions, browser mix, context, heartbeats | 142.04M | 4,953 ms | Pass |
690
+ | Heavy | 62 KiB requests with bounded custom properties | 55.26M | 7,702 ms | Below target |
691
+ | Feature | Goals, funnels, and affiliate attribution | **failed** | — | Defect [#52] |
692
+
693
+ [#52]: https://github.com/amageweb/amage-rastro/issues/52
694
+
695
+ Lean, realistic, and heavy each ran at least ten minutes, completed with zero
696
+ request failures, duplicates, or rejected events, and exactly reconciled the
697
+ expected stored events (the realistic run's reconciliation was re-executed
698
+ exactly after a client-side DNS failure — see the report). The realistic row's
699
+ driver session pool is 4,096: at current speed the historical 2,048-session pool
700
+ pushes single sessions past the documented 120 events/minute budget. Results
701
+ came from one client process against the same non-production Synapse DEV
702
+ deployment and site as the 2026-08-21 certification; they are engineering
703
+ evidence, not a production SLA.
704
+
705
+ Two caveats stand deliberately. The heavy row measured a store already holding
706
+ the battery's own multi-million-event history; the 2026-08-22 fresh-store result
707
+ (76.62M/day) remains valid for that state, and neither number overwrites the
708
+ other. The feature profile cannot currently be certified at all: affiliate
709
+ daily-rollup contention loses ~4–5% of batches under concurrent load
710
+ ([#52](https://github.com/amageweb/amage-rastro/issues/52)), so no
711
+ feature-profile capacity is claimed until the fix lands. GeoIP with a provider
712
+ enabled, trusted server-side conversions, and vitals-bearing traffic remain
713
+ separate pending certifications.
714
+
715
+ The full evidence is recorded in
716
+ [`docs/benchmarks/2026-08-30-alpha6-recertification.md`](docs/benchmarks/2026-08-30-alpha6-recertification.md).
717
+ Prior results remain in
718
+ [`docs/benchmarks/2026-08-21-formal-certification.md`](docs/benchmarks/2026-08-21-formal-certification.md)
719
+ and
720
+ [`docs/benchmarks/2026-08-20-realistic.md`](docs/benchmarks/2026-08-20-realistic.md).
313
721
 
314
722
  From a repository checkout, run a duration-based profile against a confirmed
315
723
  non-production deployment and a dedicated idle benchmark site:
316
724
 
725
+ For a deployment-free CI smoke benchmark of write-heavy ingestion plus reactive
726
+ overview and feature report queries, run:
727
+
728
+ ```bash
729
+ npm run benchmark:local
730
+ ```
731
+
732
+ The local harness uses `convex-test`, enforces a 12-document ingest transaction
733
+ budget, checks reactive totals before and after a write, and queries proven
734
+ daily rollups with the maximum configured 50 goals, 20 funnels, and 100
735
+ affiliates under deterministic 1,000-document and 4 MiB read ceilings. It also
736
+ drives concurrent ingest calls and asserts that their shared rollout/retention
737
+ control document is unchanged. It fails when its generous CI latency budgets are
738
+ exceeded. This is a deterministic local regression guard, not evidence of live
739
+ deployment throughput or capacity.
740
+
317
741
  ```bash
318
742
  npm run --silent benchmark:ingest -- \
319
743
  --url https://example.site/rastro/events \
@@ -322,7 +746,8 @@ npm run --silent benchmark:ingest -- \
322
746
  --origin https://your-allowed-origin.example \
323
747
  --profile realistic \
324
748
  --duration 600 \
325
- --concurrency 100 \
749
+ --concurrency 75 \
750
+ --batch-size 50 \
326
751
  --certify
327
752
  ```
328
753
 
@@ -332,12 +757,15 @@ visible in Live Atlas. Only `feature` intentionally matches the demo goal,
332
757
  funnel, and affiliate definitions; it does not call the trusted conversion API.
333
758
  Use `--dry-run` to inspect generated request size without sending traffic. When
334
759
  `--convex-url` is supplied, it must identify the same deployment as `--url` and
335
- expose this repository's `example:overview` query. The final reconciliation is
336
- a site-wide before/after delta, so unrelated traffic on that site invalidates
337
- the result. Reports distinguish accepted ingress, heartbeats, and stored events.
338
- Shorter completed runs report extrapolated daily estimates only. `--certify`
339
- requires at least ten minutes and successful reconciliation before emitting
340
- certified daily capacity fields or exiting successfully as a certification.
760
+ expose this repository's `benchmark:reconcileSessionsPage` query. Reconciliation
761
+ generates exact session IDs from a cryptographic run UUID and reads them through
762
+ bounded index lookups, so unrelated traffic cannot alter the result. The query
763
+ uses the session counters persisted transactionally with event batches; it
764
+ certifies ingest accounting, not raw-event availability after later retention.
765
+ Reports distinguish accepted ingress, heartbeats, and stored events. Shorter
766
+ completed runs report extrapolated daily estimates only. `--certify` requires at
767
+ least ten minutes and successful reconciliation before emitting certified daily
768
+ capacity fields or exiting successfully as a certification.
341
769
 
342
770
  The ingestion transaction folds metric/dimension deltas, session rate counters,
343
771
  site-shard counters, session/live state, visitor attribution, and exact funnel
@@ -350,31 +778,51 @@ explicit `(other)` bucket instead of relabeling old counts.
350
778
  Click/outbound/browser-conversion telemetry skips goal and funnel work that
351
779
  cannot match those event types.
352
780
 
353
- This is an additive storage migration: existing `events` rows are not deleted or
354
- backfilled. Journey and trusted-conversion reads merge legacy rows with new
355
- `eventBatches` rows. Journey `_id` values are stable strings for both formats,
356
- and session-journey cursors use timestamp, creation time, and ID so pagination
357
- matches both storage indexes. The compatibility logic is isolated in
358
- `src/component/eventStore.ts`; ingestion, reports, and retention do not branch
359
- on physical telemetry storage.
781
+ Raw telemetry is stored only in immutable `eventBatches`. Migrated events retain
782
+ their original per-event browser and geo context inside those batches, while new
783
+ events hydrate context from their session. Journey `_id` values are stable
784
+ strings derived from batch and nested-event identity, and session-journey
785
+ cursors use timestamp, creation time, and ID.
786
+
787
+ Existing deployments that still contain the retired `events` table must not
788
+ upgrade directly to this cutover. Follow the exact intermediate release and
789
+ verification sequence in [`docs/upgrading.md`](docs/upgrading.md). Fresh
790
+ deployments need no legacy-event migration.
360
791
 
361
792
  ## Privacy contract
362
793
 
363
794
  Amage Rastro's default tracker:
364
795
 
365
796
  - sets no cookies;
366
- - stores a pseudonymous session ID and referral slug in `sessionStorage`;
367
- - does not collect or persist raw visitor IP addresses;
368
- - stores coarse location only when the host edge provides it;
369
- - does not record the DOM, screenshots, keystrokes, form values, or arbitrary
370
- page text;
371
- - captures only bounded paths, explicit properties, button/anchor targets, and
372
- outbound pathnames;
797
+ - stores a pseudonymous session ID and referral slug in `sessionStorage`, and a
798
+ persistent pseudonymous visitor ID in `localStorage` scoped to the site's
799
+ origin, never shared across sites, gone when the visitor clears site data;
800
+ - never persists raw visitor IP addresses in component tables;
801
+ - counts unique visitors by that persistent pseudonymous ID; when storage is
802
+ blocked or the id is absent, a salted hash of the request IP and `User-Agent`
803
+ that rotates every UTC day takes over, derived in the HTTP action from a
804
+ per-deployment secret; a host-supplied `visitorId` always takes precedence,
805
+ and the raw IP never reaches a mutation or a table;
806
+ - never persists the raw `User-Agent`, only a normalized browser, operating
807
+ system, and device;
808
+ - processes an IP only when an edge supplies geography or an operator enables a
809
+ GeoIP provider, which receives that IP under its own privacy terms;
810
+ - stores only country, city, and coordinates rounded to one decimal place;
811
+ - does not record the DOM, screenshots, keystrokes, form values, input contents,
812
+ or arbitrary page text;
813
+ - captures only bounded paths, explicit properties, the visible label of a
814
+ clicked link or button (at most 64 characters, replaced by `data-rastro-label`
815
+ when present), and outbound link origins and pathnames;
373
816
  - strips query strings and fragments from stored paths and links.
374
817
 
375
- Cookieless does not automatically mean consent-exempt in every jurisdiction.
376
- Review your collection purpose, custom properties, identity strategy, retention
377
- policy, and local law.
818
+ The optional Web Vitals module inherits this contract: it reports at most five
819
+ timing numbers per page load (milliseconds, or CLS scaled by 1000) against the
820
+ landing path, and nothing else.
821
+
822
+ Cookieless does not automatically mean consent-exempt in every jurisdiction, and
823
+ the persistent visitor ID is an identifier under most privacy laws. Review your
824
+ collection purpose, custom properties, identity strategy, retention policy, and
825
+ local law.
378
826
 
379
827
  The example Live Atlas uses MapLibre with OpenFreeMap Positron. Map tiles are
380
828
  requested by the dashboard viewer; Amage Rastro visitor/session data is rendered
@@ -392,6 +840,10 @@ synapse dev --once
392
840
  npm run dev:frontend
393
841
  ```
394
842
 
843
+ The root `convex.json` targets the control plane in `control-plane/convex`. The
844
+ reference consumer host in `example/` is a separate Convex app; see
845
+ [`example/README.md`](example/README.md) to run, seed, and pair it.
846
+
395
847
  Quality gates:
396
848
 
397
849
  ```bash
@@ -399,20 +851,23 @@ npm test
399
851
  npm run typecheck
400
852
  npm run lint
401
853
  npm run build
402
- cd example && npx vite build
854
+ npm exec vite -- build example
403
855
  ```
404
856
 
405
857
  The test suite covers origin enforcement, event/privacy sanitization,
406
858
  idempotency, reusable session/site rate limits, bounded live expiry chains,
407
859
  folded aggregate writes, goals, funnels, trusted payments, currency safety,
408
860
  affiliate commission, cross-site journeys, keyset pagination beyond 1,000 rows,
409
- retention, HTTP routes, React integration, and tracker size/behavior.
861
+ retention, request metadata and GeoIP, exact byte boundaries, HTTP routes, React
862
+ integration, and tracker size/behavior.
410
863
 
411
- ## Synapse demo
864
+ ## Synapse deployments
412
865
 
413
- The active private development project is `ianProjects / Rastro Analytics`. The
414
- public-facing site URL is resolved from `.env.local`; credentials and
415
- `.synapse/` are gitignored.
866
+ The repository root is linked to the private Synapse project whose DEV and PROD
867
+ deployments run the control plane in `control-plane/`. The public-facing site
868
+ URL is resolved from `.env.local`; credentials and `.synapse/` are gitignored.
869
+ The consumer host in `example/` is a separate Convex app with its own deployment
870
+ link; run its CLI commands from that directory.
416
871
 
417
872
  ## License
418
873