Skip to content

Display posts ranked by GoatCounter visitor count — is there a better approach? #2695

@kuibinlin

Description

@kuibinlin

Checklist

Is your feature request related to a problem? Please describe

There's no built-in way to display posts and categories ranked by visitor count. Posts are typically listed chronologically, which doesn't help visitors discover the most popular or relevant content on the site. I'd like a way to surface posts by actual readership using GoatCounter analytics data.

Describe the solution you'd like

I've built a custom page that displays posts and categories ranked by visitor count using GoatCounter analytics.

Live demo: https://linsnotes.com/popular-posts/
Source: https://github.com/kuibinlin/kuibinlin.github.io/blob/main/_pages/popular-posts.html

How it works

  • Client-side JS fetches visitor counts from the GoatCounter API
  • Matches hit counts to posts by URL path
  • Renders posts sorted by popularity
  • Groups and aggregates counts by category

It works fine for my use case, but I wanted to check — is there a better or more recommended approach for this? Specifically:

  1. Data fetching — I'm hitting the GoatCounter API on every page load. Is there a cleaner way to pull this data, or a built-in feature I might be overlooking?

  2. Caching — Currently no caching. Would it make sense to cache the response client-side with a TTL, or is the API lightweight enough that it doesn't matter?

  3. Fallback — Right now if GoatCounter is unreachable the page just shows nothing. Any suggestions on graceful degradation?

  4. Integration — Is there an existing plugin, theme feature, or community pattern that already solves this more elegantly?

Open to any feedback or suggestions.

Describe alternatives you've considered

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions