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

stevekrouse

counterTownNico

Remix of nbbaier/counterTown
Public
Like
1
counterTownNico
Home
Code
13
.claude
1
.git
10
backend
4
frontend
5
shared
2
.vtignore
AGENTS.md
ARCHITECTURE.md
CLAUDE.md
README.md
REFACTORING_PLAN.md
biome.json
deno.json
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
1/27/2026
README.md

Counter Town

A lightweight, real-time web analytics tracker built on Val Town. Monitor traffic across multiple sites from a single dashboard—no external dependencies, no monthly bills.

Features

  • Real-time tracking – See pageviews, referrers, and top pages as they happen
  • Multi-site dashboard – Track multiple websites from one place
  • Zero infrastructure – Fully hosted on Val Town with persistent SQLite storage
  • Easy setup – Add a single script tag and you're done

Inspired by Stats and GoatCounter.

Quick Start

1. Fork the val

Click the fork button to create your own copy.

2. Initialize the database

The tables initialize automatically on first run. If you need to manually set them up, call initAnalytics() from backend/database/migrations.ts.

3. Configure your sites

Edit the counterTownConfig object in backend/lib/CounterTown.ts with your site information and add your site URLs to allowedOrigins.

4. Add the tracking script

Place this snippet just before the closing </body> tag on each site you want to track:

<script> (function() { var script = document.createElement('script'); script.async = true; script.src = 'https://<your-username>-<project-name>.val.run/trackingScript'; var firstScript = document.getElementsByTagName('script')[0]; firstScript.parentNode.insertBefore(script, firstScript); })(); </script>

Replace <your-username> and <project-name> with your Val Town username and project name (e.g., https://nbbaier-countertown.val.run/trackingScript).

5. View your dashboard

Navigate to your val's HTTP endpoint to see live analytics.

Get started with a template:
FeaturesVersion controlCode intelligenceCLIMCP
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
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.