• Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
pchinjr

pchinjr

valtown_project_analytics

Reusable analytics for Val Town apps.
Public
Like
valtown_project_analytics
Home
Code
2
README.md
H
main.ts
Environment variables
Branches
1
Pull requests
Remixes
History
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.
Sign up now
Code
/
README.md
Code
/
README.md
Search
3/19/2026
Viewing readonly version of main branch: v2
View latest version
README.md

ValTown Project Analytics

Reusable analytics ingest and browser client for lightweight event tracking across Val Town projects.

Endpoints

  • GET /client.js
  • POST /track
  • GET /summary?project=<name>
  • GET /events?project=<name>&limit=25

Browser Integration

<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>

Event Shape

{ "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 } }

Suggested Metrics

  • page_viewed
  • quiz_started
  • question_answered
  • quiz_completed
  • share_clicked
  • share_copied
  • cta_clicked

Notes

  • Events are stored in SQLite.
  • Session ids are generated client-side and persisted in localStorage.
  • The client uses sendBeacon when possible and falls back to fetch.
  • This is intended for lightweight product analytics, not full session replay or enterprise-grade analytics.
FeaturesVersion controlCode intelligenceCLIMCP
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
AboutAlternativesPricingBlogNewsletterCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
© 2026 Val Town, Inc.