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

tijs

driftline-analytics

just the currents, never the identities
Public
Like
driftline-analytics
Home
Code
10
.claude
1
backend
3
scripts
shared
2
.gitignore
.vtignore
AGENTS.md
CHANGELOG.md
README.md
deno.json
Branches
1
Pull requests
Remixes
History
Environment variables
1
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
/
Code
/
Search
index.http.ts
https://tijs--db5b135ccc4511f08d4d42dde27851f2.web.val.run
README.md

Driftline Analytics

Anonymous analytics service for ATProto app views, hosted on Valtown.

Features

  • Anonymous by design: users are identified by pseudonymous IDs derived from DIDs
  • Per-app-view isolation: same user gets different IDs across different app views
  • Simple event model: accounts, views, and actions
  • JSON stats API

API Endpoints

Base URL: https://driftline.val.run

Health Check

GET /

Collect Events

POST /collect
Headers: X-API-Key: <your-api-key>
Content-Type: application/json

Body (single event):
{
  "v": 1,
  "appView": "kipclip.com",
  "env": "prod",
  "ts": "2025-01-15T10:30:00.000Z",
  "uid": "a1b2c3d4e5f6",
  "type": "action",
  "name": "checkin_created",
  "screen": "CheckinScreen",
  "props": { "placeType": "cafe" }
}

Body (batch):
{
  "events": [...]
}

Event types:

  • account - Track account creation (once per user)
  • view - Track screen impressions
  • action - Track user actions

Get Stats

All stats endpoints require the X-API-Key header.

GET /stats/:appView?env=prod
GET /stats/:appView/accounts?env=prod
GET /stats/:appView/users?env=prod
GET /stats/:appView/events?env=prod

Client

See @tijs/driftline-client for the TypeScript client library.

Anonymity

User IDs are derived using SHA-256:

uid = sha256(salt + did).slice(0, 12)
  • Each app view uses its own salt
  • Same DID produces different UIDs across app views
  • Server never sees the original DID

Admin

Create API keys (requires ADMIN_SECRET env var):

POST /admin/api-keys
Headers: X-Admin-Secret: <admin-secret>
Body: { "appView": "your-app.com" }

Development

deno task fmt # Format code deno task lint # Lint code deno task check # Type check deno task deploy # Format, lint, check, and push to Valtown
HTTP
  • index.http.ts
    tijs--db5b135ccc4511f08d4d42dde27851f2.web.val.run
Code
.claudebackendscriptsshared.gitignore.vtignoreAGENTS.mdCHANGELOG.mdREADME.mddeno.json
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
© 2025 Val Town, Inc.