agentleFS
abduznikabduznik/abduznik-skills/skills/goatcounter-analytics/SKILL.md

goatcounter-analytics

Skill2 starsChanged 2 months agoMITView on GitHub

Query GoatCounter visitor analytics for Terraria Fetcher site.

  • Reads credentials
  • Sends data out

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 3 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Distinctive:

    All API calls need a bearer token, scoped to this GoatCounter account.

    line 27
  2. Distinctive:

    The token is a secret: Never print it in full in output, logs, or commit it to a repo.

    line 37
  3. Distinctive:

    All 5 pages carry the tracking snippet (verified live 2026-09-08):

    line 104
  4. Very specific:

    If a new HTML page is added to the site, it needs this tag added before </head> to be tracked:

    line 112

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

GoatCounter Analytics — Terraria Fetcher

This site (https://example.github.io/my-site/) has GoatCounter visitor analytics wired in via a script tag on every page. Numbers can be pulled programmatically instead of opening the dashboard manually.

Auth

All API calls need a bearer token, scoped to this GoatCounter account.

Authorization: Bearer <TOKEN>

Get/rotate a token at https://mysite.goatcounter.com/settings/api (read-only "Read statistics" scope is enough for reporting; do not request write scopes unless you actually need to create/modify sites).

The token is a secret. Never print it in full in output, logs, or commit it to a repo. Store it in whatever secret store this agent has available (env var, credential file) and reference it by name.

Token stored at: /path/to/.env as GOATCOUNTER_TOKEN

Base URL

https://mysite.goatcounter.com/api/v0

Common calls

1. Verify the token / get account info

curl -s -H "Authorization: Bearer $GOATCOUNTER_TOKEN" \
  "https://mysite.goatcounter.com/api/v0/me"

2. Pageviews per path over a date range

curl -s -H "Authorization: Bearer $GOATCOUNTER_TOKEN" \
  "https://mysite.goatcounter.com/api/v0/stats/hits?start=2026-09-01&end=2026-09-08"

Returns one entry per path with a count (total hits in range) and a daily breakdown. This is the main endpoint for "how many visitors did we get."

Note: dates are interpreted in the account's configured timezone (UTC), so a hit near midnight may land on a different day than expected in UTC.

3. List of paths tracked

curl -s -H "Authorization: Bearer $GOATCOUNTER_TOKEN" \
  "https://mysite.goatcounter.com/api/v0/paths"

4. Detailed stats for one page (browser/OS/referrer breakdown)

curl -s -H "Authorization: Bearer $GOATCOUNTER_TOKEN" \
  "https://mysite.goatcounter.com/api/v0/stats/{page}/{id}"

{id} comes from the path_id field returned by the /stats/hits call.

5. Send a pageview from a backend (not needed for this site — the

JS snippet already does this client-side; use only if tracking a non-browser event)

curl -s -X POST -H "Authorization: Bearer $GOATCOUNTER_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"no_dnt":true,"hits":[{"path":"/some/path"}]}' \
  "https://mysite.goatcounter.com/api/v0/count"

Quick "how many visitors this week" recipe

START=$(date -d '7 days ago' +%F)
END=$(date +%F)
curl -s -H "Authorization: Bearer $GOATCOUNTER_TOKEN" \
  "https://mysite.goatcounter.com/api/v0/stats/hits?start=$START&end=$END" \
  | jq '[.hits[] | {path: .path, count: .count}]'

Pages tracked on this site

All 5 pages carry the tracking snippet (verified live 2026-09-08):

  • /terraria-fetcher/ (index.html)
  • /terraria-fetcher/tree.html
  • /terraria-fetcher/compare.html
  • /terraria-fetcher/bosses.html
  • /terraria-fetcher/fetcher.html

If a new HTML page is added to the site, it needs this tag added before </head> to be tracked:

<script data-goatcounter="https://mysite.goatcounter.com/count" async src="//gc.zgo.at/count.js"></script>

Gotchas

  • /api/v0/stats/total is not a real endpoint — use /api/v0/stats/hits and sum/inspect the count fields instead.
  • Requests from bots, headless browsers, and plain curl against the site itself do not register as visits — the counter only fires from the count.js script running in an actual browser tab.
  • Rate limits apply to the public API; the /api/v0/count backend endpoint has a higher limit than the JS-facing /count endpoint.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.