---
name: visitor-stats
description: Read a week of visitor stats for your apps (a summary JSON the user provides) and suggest the next build with its reasons, checking errors against the git history first and keeping visitors anonymous. Use when choosing what to build or improve next, or when someone asks which apps people really use.
---

# Who really plays

Sloppy's own write-up of the meter room: a week of numbers comes back from the apps, and one next build goes out, with reasons anyone can check. Chat tells you what people want to ask for. The numbers tell you what people quietly come back to. You need both.

## 1. The input
- A stats summary JSON the user gives you: a file path or pasted text. Read only that. Don't go looking for other stats files, services or logs, and never make numbers up.
- No summary? Say so, show the shape below, and stop.
- A missing field means "not counted", not zero. Say which ones were missing in your answer.

```json
{
  "from": "2026-10-12",
  "to": "2026-10-18",
  "apps": [
    {
      "app": "pond-racer",
      "visitors": 46,
      "visible_minutes_median": 6.5,
      "quick_exit_share": 0.22,
      "came_back": 11,
      "phone_share": 0.68,
      "sources": { "direct": 0.40, "other_apps": 0.26, "search": 0.05, "shared_links": 0.29 },
      "slow_load_share": 0.04,
      "errors": [
        { "message": "lap is undefined", "visits": 3, "first_seen": "2026-10-14", "last_seen": "2026-10-15" }
      ]
    }
  ]
}
```

What each number means:
- `visitors`: different anonymous ids that opened the app in the window.
- `visible_minutes_median`: half the visits kept the page on screen at least this long. Background tabs don't count.
- `quick_exit_share`: visits that left within 30 seconds without touching anything (bounce).
- `came_back`: visitors seen again on a different day.
- `phone_share`: phone visits; the rest are desktops and tablets.
- `sources`: where visits came from: typed or bookmarked, a link in another of your apps, a search engine, a link someone shared.
- `slow_load_share`: visits that waited more than 3 seconds for the first screen.
- `errors`: each distinct error message, how many visits hit it, and the first and last day it was seen.

## 2. Make the calls, in this order
1. **Errors: check the git log before you touch code.** The window covers days, so an error from Tuesday still shows on Sunday after Wednesday's fix. For each error run `git log --since=<first_seen> --date=iso -- apps/<app>` and read the app's notes for the message. A change after `last_seen` that fits the message: probably fixed, so no ticket, watch next week. Seen after the newest change: real, so reproduce it in a scratch copy, then fix it. A message that names something your code never uses (a browser extension, a wallet, another site's script) isn't yours.
2. **Several people come back and play for minutes: go deeper.** At least 3 visitors back on another day, at least a tenth of the visitors, and a median of 3 minutes or more. That app earns the next feature. Rank by people back × minutes, not by visitors.
3. **Half the visits gone within 30 seconds: a clearer first screen.** Needs at least 10 visitors to mean anything. People didn't see what to do: put the name, one line of what it is and one big start on the first screen, with nothing to read before playing.
4. **A fifth of the visits load slowly: a lighter first screen.** Draw something within a second; load sounds, models and big data after.
5. **A third of the visits come from search or shared links: an SEO pass and a preview image.** The title, the description and the picture in the link are the front door. Check that each one says what the app is, in words people would search for.
6. **Under 5 visitors and nobody back: freeze it.** It keeps working; it just gets no new work until someone comes back. Frozen, not deleted.
7. **Nothing fired: leave it be.** Steady numbers don't ask for work.

And always: when 60% or more of the visits are phones, every test starts at phone size and the controls work by touch. Under about 10 visitors, percentages are a hint, not a fact: say so.

## 3. Pick one next build
- Order: an error people still hit, then depth for the app most people come back to, then the first screen that loses the most visits (count them, not the share), then slow loads, then the SEO pass.
- Give one pick, then two or three after it. A list of twelve equal ideas is not a decision.
- The numbers are a hint, not the boss: a fresh idea from chat has no week of numbers yet, and an app shipped two days ago hasn't had its week.

## 4. Answer like this
```
Next build: <app> - <the call>
Why:
- <a number and what it means, in plain words>
- <a second number>
After that: <app> - <call>; <app> - <call>
Frozen: <apps>
Checked in git: <error> in <app>: fixed by <commit> on <date> / still happening
Not counted: <fields that were missing>
```

## 5. Privacy: count visits, not people
- Count visits and totals: which page, how long it was visible, how it started and ended. Never the trail of clicks a person took.
- Nothing inside the game: no tracking of where players walk, what they build or what they type.
- Anonymous ids only: a random id kept in the browser makes "came back another day" work. No names, logins, emails or addresses next to it, and never try to work out who a visitor is.
- Totals in public: chat hears "11 people came back", never who.
- Keep the weekly summaries, not the raw visits, and only as long as you use them.

## 6. If you don't count yet
- Visible time: add up the time while `document.visibilityState` is `visible`, so a tab left open overnight doesn't count.
- Quick exit: no tap, click or key within 30 seconds, then the page closed.
- Came back: a random id in `localStorage`, created on the first visit, compared by day.
- Sources: reduce the referrer to one of four words (direct, other apps, search, shared) before you store it, never the full address.
- Errors: the `error` and `unhandledrejection` events, message and line number only, never what the player typed.
- Slow loads: the time until the first screen is drawn, from the browser's performance timings.
- Use a privacy-friendly counter you control, and say on the page what it counts.

## The trap
An error from the stats looked urgent, but the stats cover a whole week and the fix had already gone out days before. Patching it again only risks breaking working code. Check the git log first; fix only what still happens after the newest change.
