Skip to content

feat: add lite audience analytics to star-tracker#61

Merged
wavekat-eason merged 1 commit into
mainfrom
feat/star-tracker-analytics
May 17, 2026
Merged

feat: add lite audience analytics to star-tracker#61
wavekat-eason merged 1 commit into
mainfrom
feat/star-tracker-analytics

Conversation

@wavekat-eason
Copy link
Copy Markdown
Contributor

Summary

  • Logs every /:slug, /:slug/:repo, /:slug/chart.svg, and /:slug/:repo/chart.svg request into a new views_daily rollup table (one upsert-increment per request, no per-event rows).
  • Captures referer host, country (from cf.country), UA class (camo / bot / browser / other), and a 200/304 flag. No IPs, no raw UAs.
  • New owner-only Audience panel on the tenant page: 30-day stacked sparkline, top referers, top countries, client mix, fresh-vs-cached split.
  • Owner self-views and the deployment's own host (both PUBLIC_URL and the current request host — covers localhost:8787 during wrangler dev) are filtered out before logging.

Honest about the limits up front in the panel copy: SVGs are cached 5 min at the edge and GitHub Camo fronts README embeds, so totals undercount — referer/country mix stays meaningful.

Test plan

  • npm run db:migrate:local then npm run dev, hit /:slug/chart.svg and /:slug from an incognito tab, verify the Audience panel populates while signed-in-owner views don't.
  • Hit the SVG twice in a row, confirm the second is logged as cached (304).
  • Confirm localhost and stars.wavekat.com never show up under Top referers.
  • Apply the migration to prod (npm run db:migrate) before deploying.

🤖 Generated with Claude Code

Logs each chart-svg and HTML page request into a daily-aggregated
views_daily table (referer host, country from cf.country, UA class,
200/304). Rendered as an "Audience" panel on the owner's tenant page:
30-day sparkline, top referers, top countries, client mix. No IPs or
raw user-agents stored. Owner self-views and our own domain (in any
env) are excluded.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

@wavekat-eason wavekat-eason merged commit 2e4b975 into main May 17, 2026
4 checks passed
@wavekat-eason wavekat-eason deleted the feat/star-tracker-analytics branch May 17, 2026 08:42
wavekat-eason pushed a commit that referenced this pull request May 17, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.0.22](wavekat-com-v0.0.21...wavekat-com-v0.0.22)
(2026-05-17)


### Features

* add favicon to star-tracker
([#60](#60))
([4075b41](4075b41))
* add gtag analytics to star-tracker
([#58](#58))
([5441af3](5441af3))
* add lite audience analytics to star-tracker
([#61](#61))
([2e4b975](2e4b975))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant