
Public
Likevaltown_project_analytics
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Viewing readonly version of main branch: v2View latest version
Reusable analytics ingest and browser client for lightweight event tracking across Val Town projects.
GET /client.jsPOST /trackGET /summary?project=<name>GET /events?project=<name>&limit=25
<script src="https://pchinjr--2dfdceb4239511f1baa142dde27851f2.web.val.run/client.js" defer></script> <script defer> window.addEventListener("DOMContentLoaded", function () { const analytics = window.ValTownAnalytics.init({ project: "my-project", globalProps: { app: "my-project", }, }); analytics.track("page_viewed", { screen: "landing" }); }); </script>
{ "project": "guess-that-hype", "event": "quiz_started", "sessionId": "vt-...", "pagePath": "/", "pageUrl": "https://example.web.val.run/", "referrer": "https://example.com/", "source": "browser", "ts": "2026-03-19T13:00:00.000Z", "props": { "runId": "...", "questionsPerRun": 8 } }
page_viewedquiz_startedquestion_answeredquiz_completedshare_clickedshare_copiedcta_clicked
- Events are stored in SQLite.
- Session ids are generated client-side and persisted in
localStorage. - The client uses
sendBeaconwhen possible and falls back tofetch. - This is intended for lightweight product analytics, not full session replay or enterprise-grade analytics.