Skip to content

feat(get): count installs with analytics engine - #32

Merged
JheisonMB merged 1 commit into
developfrom
feature/add-get-worker-counter
Jul 28, 2026
Merged

feat(get): count installs with analytics engine#32
JheisonMB merged 1 commit into
developfrom
feature/add-get-worker-counter

Conversation

@JheisonMB

Copy link
Copy Markdown
Contributor

Adds aggregate install counting to the get.univerlab.org Worker, so a launch produces data instead of guesses.

Why

The Worker deliberately counted nothing. That was the right call at zero users, but it stops being right the week we start publishing: a traffic spike would teach us nothing about whether anyone actually installed anything.

What it records

One data point per request: tool, platform (sh/ps1), coarse client class (curl/powershell/browser), country, referrer host, and outcome (redirect/unknown-tool/no-windows).

Not recorded: IP addresses, full user-agents, cookies, anything tied to a person. The client class is a bucket, not the raw header.

unknown-tool is worth calling out — it captures 404s, so we learn which tools people expected to exist.

Why Analytics Engine

Writes are fire-and-forget, so no latency is added to the redirect, and there is no database to provision. KV would need read-modify-write and rate-limits at 1 write/sec/key — it would break exactly during a launch spike. D1 would put a SQL write in the hot path of every install.

Included in the Workers free plan (100k data points/day), and the dataset is created automatically on first write.

Safety

The binding is optional in code and the write sits in a try/catch. If Analytics Engine is unavailable, the install still works. Verified locally with wrangler dev: all five paths unchanged (302 install.sh, 302 install.ps1, 404 no-Windows, 404 unknown tool, 302 root).

The supply-chain argument is unchanged: the Worker still proxies nothing, and scripts still come from GitHub.

Known gap

curl | sh sends no Referer, so referrer is only populated for browser visits. Launch attribution is by time correlation, not referrer.

Reading the data is also unsolved: Analytics Engine has no dashboard and wrangler has no command for it, so the SQL API is the only way in and it needs a long-lived token. Query tooling is deliberately kept out of this repo (workers/get/scripts/, gitignored) rather than shipping a pattern that encourages plaintext credentials on a laptop. Options are written up in the README.

In the meantime the Workers dashboard shows total requests, which is enough to spot a launch spike without any token.

Docs

The README previously promised "no counting" as a trust guarantee. It now states exactly what is recorded and what is not.

@JheisonMB JheisonMB added the target:develop Targets the develop branch label Jul 28, 2026
@JheisonMB
JheisonMB merged commit 43d1dac into develop Jul 28, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

target:develop Targets the develop branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant