JS-friendly ways to show post view counts (from dead-simple badges to full analytics APIs):
Tool / Plugin | Approach | Display method | Where counts live | Pricing | Good for | Notes |
---|---|---|---|---|---|---|
Busuanzi (不蒜子) | Drop-in JS snippet | Auto-fills spans like #busuanzi_value_page_pv |
Public Busuanzi service (or self-host) | Free | Static blogs, quick PV/UV | 2-line embed; can self-host if the public endpoint is slow. ([busuanzi.ibruce.info][1]) |
CountAPI (countapi.xyz) | REST counter (increment + fetch) | fetch('https://api.countapi.xyz/hit/...') then render |
CountAPI cloud | Free | Tiny counters per-post | Official wrapper countapi-js on npm; simple to wire up. ([npm][2]) |
GoatCounter | Lightweight analytics with optional on-page counter | Built-in visitor counter (HTML/img) or JS API | GoatCounter cloud or self-host | Free OSS / paid SaaS | Privacy-minded blogs/apps | Enable “Allow adding visitor counts” to expose per-page counts. ([goatcounter.com][3]) |
Plausible | Privacy analytics + public API | Query pageviews via Stats API and render | Plausible cloud or self-host | Paid (trial) / OSS | Sites already using Plausible | Use /api/v2/query (or Events API) to fetch views for a path. ([Plausible Analytics][4]) |
Umami | Open-source analytics with API | Call /api/websites/:id/pageviews and render |
Self-host or Umami Cloud | OSS / paid cloud | Self-hosted stacks | Simple pageviews endpoint for a time range. ([umami.is][5]) |
Simple Analytics | Privacy analytics + public JSON | Stats API; can read JSON (public sites) client-side | Simple Analytics cloud | Paid | SPA/SSR sites needing an API | Docs note public JSON is accessible for public sites. ([Simple Analytics Docs][6]) |
Counter.dev | Minimal analytics (script) | Internal dashboard (no official public counter) | counter.dev cloud / self-host | Free | Super-simple tracking | Open-source server; great for totals, less for on-page counters. ([Counter][7]) |
HitsCounter.dev | No-JS image badge counter | Embed an <img> badge showing total/today |
HitsCounter cloud | Free | GitHub Pages, docs, quick demos | Replacement for seeyoufarm-style badges; zero JS. ([Hits Counter][8]) |
Busuanzi (npm build) | NPM module variant of Busuanzi | Import and mount in bundlers | Public Busuanzi (or self-host) | Free | Next.js/Vite bundlers | busuanzi.pure.js for module-based setups. ([GitHub][9]) |
Quick picks
- Need a 2-minute, no-account counter on a static blog → Busuanzi. ([busuanzi.ibruce.info][1])
- Already using a privacy analytics tool → fetch from Plausible/Umami/Simple Analytics and render. ([Plausible Analytics][4])
- Want a one-file badge (no JS) → HitsCounter.dev. ([Hits Counter][8])
- Prefer a tiny REST counter you control in code → CountAPI. ([npm][2])
If you tell me your stack (Ghost, Next.js, Webflow, Shopify, etc.), I can give you a paste-ready snippet (with caching & fallback) tailored to your setup.